- Issue created by @jacobbell84
- Status changed to Fixed
about 2 years ago 10:15pm 15 March 2023 - π΅π±Poland sayco ToruΕ
Thank you for reporting indeed seems like I was too strict (actually I wasn't aware that Core does not have strict typing for this argument).
I also agree that the relevant changes should be done first in Drupal core, then we could adapt it to a more strict mode.
I've merged your patch partially. I've reworked a bit of it related to the if statement - use the early return instead of wrapping the whole block with if. - Status changed to Needs work
about 2 years ago 2:52pm 23 March 2023 - πΊπΈUnited States scotwith1t Birmingham, AL
I'm confused...the patch isn't implemented, but rather a different approach which doesn't seem to address the underlying concern, namely that the typing in the definition is stricter than the hook it is implementing. I am applying the patch instead of just using the latest version and that fixes my issue. I don't think the approach in 3.1-dev (not 3.1.1) goes far enough and am re-opening for another look.
It also might make sense to add a check of the entity type while you're at it, something like
if ($entity->getEntityTypeId() !== 'paragraph') return;
to ensure even further that this hook implementation doesn't over-reach. Thanks!
- πΊπΈUnited States jacobbell84
Hi scotwith1t,
That's a good idea on the entity type check. Concerning what was committed though, while different then my original patch, does still address the root cause of the issue as far as I can tell. https://git.drupalcode.org/project/paragraph_view_mode/-/commit/e7ccca92...Removing the 'string' parameter type was the main part of the fix, which I see there and on the current dev release.
- Status changed to Postponed: needs info
about 2 years ago 10:05pm 23 March 2023 - π΅π±Poland sayco ToruΕ
@scotwith1t Thank you for sharing your thoughts on this issue. It's as @jacobbell84 said. The main difference between the original patch and the new approach is that the latter uses an early return statement instead of executing the code in the if statement. However, both versions should function the same way and address the underlying concern.
Based on that fact I assume that the original problem has been resolved? Is this correct? Or is it for some reason working differently for you on the dev branch?If you feel that there's a specific problem that's different from the original issue (which in my opinion was solved), it would be best to create a new issue and provide detailed information there. This will help to ensure that the issue is properly tracked and addressed.
BTW it is worth mentioning that I have implemented a proper checking, but for the ParagraphInterface instead of the entity id. Please have look on DisplayModeMatcher https://git.drupalcode.org/project/paragraph_view_mode/-/blob/3.x/src/Matcher/DisplayModeMatcher.php#L80 for more details.
- πΊπΈUnited States scotwith1t Birmingham, AL
Thanks folks. All that makes sense. Moving forward with the latest dev and looking forward to a new stable release with that in the future. Thx!
- Status changed to Fixed
almost 2 years ago 9:24am 25 April 2023 Automatically closed - issue fixed for 2 weeks with no activity.