Needs review
Project:
Drupal core
Version:
main
Component:
toolbar.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
18 Jul 2026 at 11:35 UTC
Updated:
23 Jul 2026 at 13:18 UTC
Jump to comment: Most recent
Deprecate toolbar module
Move toolbar hook implementations to the toolbar module
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
quietone commentedComment #4
nicxvan commentedGot some suggestions on the MR.
Comment #5
quietone commented@nicxvan, thanks.
I agree that removing 'Hook' is an improvement. And, like you it seems, on the fence about 'Toolbar' in the method name. Somehow, with these long methods, I think the name helps a bit.
Comment #6
meeni_dhobale commentedTested MR !16354 against 11.x (PHP 8.3).
The hook consolidation itself works: verified the toolbar renders identically before and after applying the MR (home, administration, announcement, contextual, user items all present with the same permissions/conditions as the original separate hook implementations), and the toolbar, contextual, and announcements_feed test suites pass.
However, this introduces a regression.
ToolbarHooks::toolbar()gates the workspace item on$this->moduleHandler->moduleExists('workspaces'), butworkspacesToolbar()depends on theworkspaces_ui.lazy_buildersservice, which only exists when theworkspaces_uimodule is enabled.workspacesandworkspaces_uiare separate installable modules (workspaces_uidepends onworkspaces, not the reverse), so a site with onlyworkspacesenabled will hit a fatalInvalidArgumentException: Class "workspaces_ui.lazy_builders" does not exist.the moment the toolbar renders. Before this MR that was safe, since the hook lived entirely insideworkspaces_ui's own hook class and was simply never invoked unlessworkspaces_uiwas enabled. I think the check needs to bemoduleExists('workspaces_ui')instead.But flagging this for a maintainer to confirm in case I'm missing some context on how these two modules are meant to interact.
Comment #7
quietone commented@meeni_dhobale, thanks for catching that error. I think that is a simple oversight on my part and it should be workspaces_ui. I have made those changes.
Comment #8
nicxvan commentedHooksnuck back into the name of the updated method. I added a new round of suggestions.Comment #9
quietone commentedArg!
@nicxvan, thanks for making suggestions.
Comment #10
smustgrave commentedLeft 1 question on the MR but looking good.