- Issue created by @rachel_norfolk
- First commit to issue fork.
3531836-move-hook-out branch.
Move hook out of .module file. Also make it backward compatible for Drupal 10.1Changing status to needs review.
- š¬š§United Kingdom rachel_norfolk UK
I think you still need to press the button in Gitlab to tell it to create the Merge Request.
Before you do, though, one thing worth bearing in mind is that, whilst inside a .module
t()
is acceptable, once in a Hook class, we really should use theStringTranslationTrait
to add in$this->t()
and use that.You can see an example in core/modules/block/src/Hook/BlockHooks.php
Also, Iām still getting used to reading these new hook styles so I might have missed something!
Thank you. Applied the changes to use StringTranslationTrait instead of global t function. Also applied the merge request.
-
rachel_norfolk ā
committed df0c299c on 1.0.x authored by
n-m-daz ā
Resolve #3531836 "Move hook out of .module file"
-
rachel_norfolk ā
committed df0c299c on 1.0.x authored by
n-m-daz ā
- š¬š§United Kingdom rachel_norfolk UK
Nice one!
I also slightly changed the version requirement to at least 10.1 as Change Record says that is required for that method of calling the hook in a class.
Automatically closed - issue fixed for 2 weeks with no activity.