Problem/Motivation
The Varbase Content Planner submodule (part of the Varbase Workflow project) currently implements its hooks as procedural functions in varbase_content_planner.module. Drupal 11 provides object-oriented hooks via the #[Hook] attribute (see the OOP hooks change record), which are autoloaded, easier to test, and support dependency injection.
Steps to reproduce
N/A — this is a code-quality refactoring task, not a defect. To see the current state:
- Open
varbase_content_planner.modulein thevarbase_content_plannersubmodule. - Note that
hook_theme(),hook_theme_suggestions_HOOK_alter()(foritem_list) andhook_toolbar_alter()are implemented procedurally rather than as OOP#[Hook]methods.
Proposed resolution
Move the procedural hook implementations (hook_theme, hook_theme_suggestions_HOOK_alter for item_list, and hook_toolbar_alter) into a new object-oriented hook class \Drupal\varbase_content_planner\Hook\VarbaseContentPlannerHooks, using the #[Hook] attribute. hook_preprocess_varbase_item_list() is kept procedural in the .module file.
Remaining tasks
- ✅ File an issue about this project
- ✅ Addition/Change/Update/Fix to this project
- ✅ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ✅ Reviewed by a human
- ✅ Code review by maintainers
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Update Release Notes
- ✅ Release varbase-9.2.0, varbase_workflow-2.2.0
User interface changes
- N/A — internal refactor only, no user-facing UI change.
API changes
- None. These are standard hooks invoked by Drupal core only; converting them to the OOP
#[Hook]pattern (https://www.drupal.org/node/3442349) does not change any public API or hook contract.
Data model changes
- N/A
Release notes snippet
task: #3608325 Convert the procedural hooks to OOP hook classes in the Varbase Workflow module
Issue fork varbase_workflow-3608325
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
rajab natshahComment #7
rajab natshah✅ Released varbase_workflow-2.2.0
Comment #9
rajab natshah✅ Released varbase-9.2.0