Problem/Motivation
The Varbase profile implements hook_toolbar_alter() as a procedural function in varbase.profile. Drupal 11 provides object-oriented hooks via the #[Hook] attribute (change record), which are autoloaded and support dependency injection.
Steps to reproduce
Review varbase.profile: hook_toolbar_alter() is a procedural function.
Proposed resolution
Move the runtime hook_toolbar_alter() implementation into an object-oriented hook class Drupal\varbase\Hook\VarbaseHooks using the #[Hook] attribute, with the current user injected via the constructor. The install-phase hooks (hook_install_tasks, hook_install_tasks_alter, hook_form_install_configure_form_alter), hook_requirements() and the install task callback helpers are kept procedural, since they run in the minimal installer environment.
Remaining tasks
- ✅ Add
src/Hook/VarbaseHooks.php(toolbar_alter) - ✅ Reduce
varbase.profile - ➖ Keep install-phase hooks + hook_requirements procedural
- ✅ Reviewed by a human
User interface changes
None.
API changes
None. Standard hook invoked by core only; see the OOP hooks change record.
Data model changes
None.
Release notes snippet
Converted the Varbase profile hook_toolbar_alter() implementation to a Drupal 11 object-oriented hook class.
Release notes snippet
refactor: #3608347 Convert the procedural hooks to OOP hook classes in the Varbase profile
Issue fork varbase-3608347
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 #4
rajab natshah✅ Part of the Varbase 9.2.0 release (tagged
varbase-9.2.0).Comment #6
rajab natshah✅ Released varbase-9.2.0