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 \Drupal calls with object oriented hooks.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork crm-3535764

Command icon 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

lostcarpark created an issue. See original summary.

lostcarpark’s picture

I tried converting User related hooks as the first step, and all went smoothly.

lostcarpark’s picture

Status: Active » Needs review

I 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.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9 changed the visibility of the branch 1.0.x to hidden.

bluegeek9’s picture

Status: Needs review » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triaging issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.