function ToolbarHooks::toolbarAlter
Same name and namespace in other branches
- main core/modules/toolbar/src/Hook/ToolbarHooks.php \Drupal\toolbar\Hook\ToolbarHooks::toolbarAlter()
Implements hook_toolbar_alter().
Attributes
File
-
core/
modules/ toolbar/ src/ Hook/ ToolbarHooks.php, line 429
Class
- ToolbarHooks
- Hook implementations for toolbar.
Namespace
Drupal\toolbar\HookCode
public function toolbarAlter(&$items) : void {
// As the "Announcements" link is shown already in the top toolbar bar, we
// don't need it again in the administration menu tray, so hide it.
if (!empty($items['administration']['tray'])) {
$callable = function (array $element) {
unset($element['administration_menu']['#items']['announcements_feed.announcement']);
return $element;
};
$items['administration']['tray']['toolbar_administration']['#pre_render'][] = $callable;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.