W3cubDocs

/Drupal 8

function hook_toolbar_alter

hook_toolbar_alter(&$items)

Alter the toolbar menu after hook_toolbar() is invoked.

This hook is invoked by toolbar_view() 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

Hooks
Define functions that alter the behavior of Drupal core.

File

core/modules/toolbar/toolbar.api.php, line 163
Hooks provided by the toolbar module.

Code

function hook_toolbar_alter(&$items) {
  // Move the User tab to the right.
  $items['commerce']['#weight'] = 5;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!toolbar!toolbar.api.php/function/hook_toolbar_alter/8.1.x