Problem/Motivation
Varbase Editor currently implements its hooks as procedural functions in varbase_editor.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. The procedural implementations of hook_editor_js_settings_alter(), hook_library_info_alter() and hook_filter_info_alter() in the module should be converted to the new OOP hook pattern.
Steps to reproduce
N/A — this is a code-quality refactoring task, not a defect. To see the current state:
- Open
varbase_editor.module. - Note that
hook_editor_js_settings_alter(),hook_library_info_alter()andhook_filter_info_alter()are implemented procedurally rather than as OOP#[Hook]methods.
Proposed resolution
Move the procedural hook implementations (hook_editor_js_settings_alter, hook_library_info_alter, hook_filter_info_alter) into a new object-oriented hook class \Drupal\varbase_editor\Hook\VarbaseEditorHooks, using the #[Hook] attribute, with the module handler injected via the constructor. The .module file is reduced to its @file docblock.
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_editor-9.2.14
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: #3608324 Convert the procedural hooks to OOP hook classes in the Varbase Editor module
Issue fork varbase_editor-3608324
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_editor-9.2.14
Comment #9
rajab natshah✅ Released varbase-9.2.0
Comment #10
rajab natshahComment #11
rajab natshah✅ Released varbase_editor-10.1.3