Active
Project:
Layout Builder Kit
Version:
8.x-1.0-beta5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 May 2022 at 18:48 UTC
Updated:
6 Dec 2022 at 18:21 UTC
Jump to comment: Most recent
Comments
Comment #2
aangel commentedThanks for the report. Because version 3 of hook_event_dispatcher is a major upgrade and they note it may not be backward compatible, that forces LBK to create a new branch (version 2) since we can't force current users to upgrade and potentially cause problems. There may be other dependencies that should be upgraded at the same time. We'll take a look.
Comment #3
cpigott commentedIs there anything anyone can do to speed up resolution of this? The daily emails are making me sad :(
Comment #4
joelsteidl commented@aangel
Would you be willing to create a 8.x-3.x or 3.x branch? If so, I'd be happy to create a merge request so we can see if the 3.x version of hook_event_dispatcher breaks things too badly.
Thanks!
Comment #7
zterry95 commentedI'm using hook_event_dispatcher:3.2 in my local, and works good.
So I create a MR just change the hook_event_dispatcher from 2 to 3, hope it helps and can be merged.
Comment #8
joelsteidl commented@zterry95 I'm actually seeing quite a few errors. Layout Builder Kit will need some work to use hook_event_dispatcher 3.x.
For example
ThemeEventis now part of a submodule calledcore_event_dispatcherComment #9
cpigott commentedI've just tried the merge request out, unfortunately I've run into some errors when clearing the cache (i.e. before I've even tried using the module):
Looking at the composer log, it seems to have removed core_event_dispatcher ? But it's also included inside hook_event_dispatcher? I'm not quite sure of the relationship between these packages
Comment #10
cpigott commentedOn looking deeper, this appears to be related to https://www.drupal.org/project/hook_event_dispatcher/issues/3285706
However I haven't found a workaround for it - my attempt to just comment out the offending bits of code in all the layout_builder_kit/src/Plugin/Block/LBK*/*EventSubscriber.php files until I could actually properly rebuild cache/update db, then put them back again doesn't seem to have worked - the class is still unavailable
Comment #11
joelsteidl commented@cpigott
It makes me feel better that you found an issue. It was driving me crazy and I ended up giving up for the time being. The code changes in Layout Builder Kit were minimal, so hopefully everything will work as expected once hook_event_dispatcher resolves that issue.
Comment #12
cpigott commentedTrouble is that the linked issue doesn't really have any satisfactory workaround, which I'd say pretty strongly blocks this MR - I'd be very surprised if I'm going to be the only one to run into this otherwise....
The possible workarounds I can see is either wrapping all the usages of ThemeHookEvents in a `if (class_exists)`, or just hardcoding the names and not using ThemeHookEvents at all. Neither of which feel particularly nice.
Apparently none of the other modules that I'm currently using that use getSubscribedEvents (need to?) use the class_exists workaround anywhere, though a few do hardcode the names
Any thoughts on which workaround is more feasible?
Comment #14
aangel commentedI've opened the 2.x branch, merged this and other MRs and my initial testing is positive using the 3.x branch of HED.
If anyone wants to try it, I've tagged a 2.0.0-dev. In composer, use:
"drupal/layout_builder_kit": "2.x-dev"
I also tried it against D10 but there's a PHP8 requirement that's not worked out with one of the dependencies; it installs with:
composer update --ignore-platform-reqs
Comment #15
cpigott commentedExcellent to see some progress.
Briefly tried it out, but still getting the issue with ThemeHookEvents mentioned above
I see you tried using HookEventDispatcherInterface in https://git.drupalcode.org/project/layout_builder_kit/-/commit/ecfb8d730... , but later reverted it. What was the reason for the reverting?
Comment #16
aangel commented@cpigott I reverted that commit because I came across this change record noting that those constants are being deprecated:
Events constant in \Drupal\hook_event_dispatcher\HookEventDispatcherInterface are deprecated
https://www.drupal.org/node/3263301
Regarding not having access to the constants before the module is enabled, there seems to be a leaning toward using class names, per:
https://www.drupal.org/project/drupal/issues/2825358#comment-14432778
Comment #17
aangel commentedI'm running low on other things to do and I, too, am stuck on the ThemeHookEvents issue. Tomorrow I'll try posting a question somewhere.
Comment #18
aangel commented2.0.0-alpha2 is ready for folks to try. Had to use a hardcoded string ($events['hook_event_dispatcher.theme']).