Problem/Motivation
Drupal now supports object oriented hooks. These offer several advantages, particularly support for dependency injection, and they can be slightly more performant.
As we are only supporting Drupal 11, there is no need to implement backwards compatibility with LegacyHook.
Steps to reproduce
Proposed resolution
Move hooks into new classes.
Remaining tasks
- Add new hook classes.
- Convert hooks from
crm.module. - Replace
\Drupalcalls with object oriented hooks.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork crm-3535764
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
lostcarpark commentedI tried converting User related hooks as the first step, and all went smoothly.
Comment #4
lostcarpark commentedI have converted hooks to the new object oriented style.
The only functions remaining in the .module file are the template preprocess functions. Not sure if it's possible to replace them and remove the .module file altogether.
I also updated tests making direct calls to hook functions.
All tests are passing, and I've carried out some manual testing. Not sure if there are any gaps in our test coverage. I'm sure my manual tests didn't cover all the functionality provided by the hooks.
Appreciate if anyone can review.
Comment #8
bluegeek9 commented