- Issue created by @rodrigoaguilera
- Status changed to Needs review
about 2 years ago 8:00pm 16 March 2023 - π΅π±Poland sayco ToruΕ
Hi @rodrigoaguilera! Thanks for such a write-up and so many kind words on this particular module.
The thing about `invoke` in Drupal core is also a bit strange to me.
The Drupal\Core\Extension\ModuleHandlerInterface the invoke "Invokes a hook in a particular module" in contrary to the `invokeAll` which "Invokes a hook in all enabled modules that implement it."From what I can see in the core, it is used mainly for the hooks like `install`, `uninstall`, `schema`, `mail`, `help`.
I've decied that in case of the `invoke` which is called per module there is no point to dispatch the event for a specific module as well if it already has this hook implemented to avoid redundancy.
I don't think this limitation do any harm, but if there will be a need for chaning this behaviour we can of course consider to change it.I hope my answer will somehow help you when working with the module.
If you consider my answer as complete, please mark the issue as fixed, thanks!
- πͺπΈSpain rodrigoaguilera Barcelona
I get it now. I think is better to rephrase a bit.
There is special hooks that are called only for a specific module, for example `install`, `uninstall`, `schema`, `mail` and `help` (by the invoke() method in the ModuleHandler). When the module "invoked" already has an implementation no event will be dispatched to avoid conflicts.
I think the key there is to mention examples for the hooks. A developer that understands a hook_install will understand better the reason for that behavior.
Also there is a typo in the module description: HookPreprocesEvent is missing an "s".
I will give a try to hook_install ASAP.