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.moduleandvarbase_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
- Released in varbase_core-9.2.0
Issue fork varbase_core-3608369
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:
- 3608369-9.2.x
changes, plain diff MR !71
- 3608369-convert-the-procedural
changes, plain diff MR !70
- none
changes, plain diff MR !69
Comments
Comment #8
rajab natshahComment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahComment #12
rajab natshahComment #13
rajab natshahComment #14
rajab natshah✅ Released varbase_core-9.2.0
Comment #15
rajab natshahComment #16
rajab natshahComment #18
rajab natshah✅ Released varbase-9.2.0
Comment #19
rajab natshahComment #20
rajab natshah✅ Released in varbase_core-10.1.64.