function 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
6 functions implement hook_toolbar_alter()
Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.
- AnnouncementsFeedHooks::toolbarAlter in core/modules/ announcements_feed/ src/ Hook/ AnnouncementsFeedHooks.php 
- Implements hook_toolbar_alter().
- AnnouncementsFeedToolbarHooks::toolbarAlter in core/modules/ announcements_feed/ src/ Hook/ AnnouncementsFeedToolbarHooks.php 
- Implements hook_toolbar_alter().
- SettingsTrayHooks::toolbarAlter in core/modules/ settings_tray/ src/ Hook/ SettingsTrayHooks.php 
- Implements hook_toolbar_alter().
- settings_tray_toolbar_alter in core/modules/ settings_tray/ settings_tray.module 
- Implements hook_toolbar_alter().
- ToolbarDisableUserToolbarHooks::toolbarAlter in core/modules/ toolbar/ tests/ modules/ toolbar_disable_user_toolbar/ src/ Hook/ ToolbarDisableUserToolbarHooks.php 
- 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.
