function announcements_feed_toolbar_alter

Same name in other branches
  1. 11.x core/modules/announcements_feed/announcements_feed.module \announcements_feed_toolbar_alter()

Implements hook_toolbar_alter().

File

core/modules/announcements_feed/announcements_feed.module, line 74

Code

function announcements_feed_toolbar_alter(&$items) {
    // 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.