Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AnnouncementsFeedHooks.php

function AnnouncementsFeedHooks::toolbarAlter

Implements hook_toolbar_alter().

File

core/modules/announcements_feed/src/Hook/AnnouncementsFeedHooks.php, line 84

Class

AnnouncementsFeedHooks
Hook implementations for announcements_feed.

Namespace

Drupal\announcements_feed\Hook

Code

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;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal