- π©πͺGermany donquixote
Let's add related tests here, π Order of alter hooks is not always respected by ModuleHandler Needs work
- π©πͺGermany donquixote
I believe changing this as proposed would make some happy and others unhappy.
The impact will become more clear with the new order tests added in π Order of alter hooks is not always respected by ModuleHandler Needs work .
I suggest to keep the functionality as it is today, and wait for π Hux-style hooks, proof of concept Needs work which will allow to specify weights for individual implementations.----
For people who still need this, there _is_ a workaround!
You can invent a fake module, and use hook_module_implements_alter() to insert an implementation on behalf of that fake module.E.g. Display Suite (ds) can invent a fake module '_ds_late', for hooks that should run late.
Then do this:
function ds_module_implements_alter(array &$implementations, string $hook): void { // Always target the the base hook, otherwise implementations will be removed. if ($hook === 'entity_view_alter') { $implementations['_ds_late'] = FALSE; } } // This will run last on ->alter(['entity_view', 'node_view']). function _ds_late_node_view_alter(...) {...}
I am not sure if we will or should support this workaround in π± [META] Hooks via attributes on service methods (hux style) Active , though.
- π©πͺGermany donquixote
Sorry, links in my previous posts were wrong.
Correct link is π Improve unit test coverage for ModuleHandler RTBC
(I already corrected, but this is for people who only read the emails) - πΊπΈUnited States nicxvan
Is this resolved in π OOP hooks using event dispatcher Needs review ?
- First commit to issue fork.