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:

  1. Open varbase_editor.module.
  2. Note that hook_editor_js_settings_alter(), hook_library_info_alter() and hook_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
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’s picture

Issue summary: View changes

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

  • rajab natshah committed a6155425 on 9.2.x
    task: #3608324 Convert the procedural hooks to OOP hook classes in the...
rajab natshah’s picture

Issue summary: View changes
Status: Active » Fixed
Issue tags: +varbase-9.2.0, +varbase_editor-9.2.14

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

Status: Fixed » Closed (fixed)

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