function hook_toolbar_alter
Same name in other branches
- 9 core/modules/toolbar/toolbar.api.php \hook_toolbar_alter()
- 8.9.x core/modules/toolbar/toolbar.api.php \hook_toolbar_alter()
- 11.x core/modules/toolbar/toolbar.api.php \hook_toolbar_alter()
Alter the toolbar menu after hook_toolbar() is invoked.
This hook is invoked by Toolbar::preRenderToolbar() immediately after hook_toolbar(). The toolbar definitions are passed in by reference. Each element of the $items array is one item returned by a module from hook_toolbar(). Additional items may be added, or existing items altered.
Parameters
$items: Associative array of toolbar menu definitions returned from hook_toolbar().
Related topics
3 functions implement hook_toolbar_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- announcements_feed_toolbar_alter in core/
modules/ announcements_feed/ announcements_feed.module - Implements hook_toolbar_alter().
- settings_tray_toolbar_alter in core/
modules/ settings_tray/ settings_tray.module - Implements hook_toolbar_alter().
- toolbar_disable_user_toolbar_toolbar_alter in core/
modules/ toolbar/ tests/ modules/ toolbar_disable_user_toolbar/ toolbar_disable_user_toolbar.module - Implements hook_toolbar_alter().
1 invocation of hook_toolbar_alter()
- Toolbar::preRenderToolbar in core/
modules/ toolbar/ src/ Element/ Toolbar.php - Builds the Toolbar as a structured array ready for rendering.
File
-
core/
modules/ toolbar/ toolbar.api.php, line 163
Code
function hook_toolbar_alter(&$items) {
// Move the User tab to the right.
$items['commerce']['#weight'] = 5;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.