Problem/Motivation

The Varbase Core module implements its hooks as procedural functions in varbase_core.module and varbase_core.tokens.inc. Drupal 11 provides object-oriented hooks via the #[Hook] attribute (change record), which are autoloaded and support dependency injection — the recommended pattern for Drupal ~11.4.0.

Proposed resolution

Move all hook implementations (hook_form_node_form_alter, hook_form_alter, hook_template_preprocess_default_variables_alter, hook_modules_installed, hook_email_registration_name_alter, hook_token_info, hook_tokens) into an object-oriented hook class Drupal\varbase_core\Hook\VarbaseCoreHooks using the #[Hook] attribute, with the config factory, class resolver, request stack and theme manager injected via the constructor. The varbase_core.module and varbase_core.tokens.inc files are removed.

Remaining tasks

  • ✅ Add src/Hook/VarbaseCoreHooks.php
  • ✅ Remove varbase_core.module and varbase_core.tokens.inc
  • ✅ Reviewed by a human
  • ✅ Release varbase-9.2.0, varbase_core-9.2.0

User interface changes

None.

API changes

None. Standard hooks invoked by core only; see the OOP hooks change record.

Data model changes

None.

Release notes snippet

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

rajab natshah created an issue. See original summary.

  • rajab natshah committed e93eef69 on 10.1.x
    task: #3608369 Convert the procedural hooks to OOP hook classes in the...

  • rajab natshah committed 5f6243e3 on 9.2.x
    task: #3608369 Convert the remaining procedural tokens to the OOP hook...
rajab natshah’s picture

Issue tags: +varbase_core-9.2.0
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
Issue tags: +varbase-9.2.0
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Assigned: Unassigned » josebc
Status: Active » Needs review
rajab natshah’s picture

Assigned: josebc » mohammed j. razem
Issue summary: View changes

✅ Released varbase_core-9.2.0

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Issue summary: View changes

✅ Released varbase-9.2.0

rajab natshah’s picture

Version: 10.1.x-dev » 9.2.x-dev
rajab natshah’s picture

✅ Released in varbase_core-10.1.64.

Status: Fixed » Closed (fixed)

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