You are here

function admin_toolbar_toolbar_alter in Admin Toolbar 8

Same name and namespace in other branches
  1. 8.2 admin_toolbar.module \admin_toolbar_toolbar_alter()
  2. 3.x admin_toolbar.module \admin_toolbar_toolbar_alter()

Implements hook_toolbar_alter().

File

./admin_toolbar.module, line 17
This is the module to create a drop-down menu for the core toolbar.

Code

function admin_toolbar_toolbar_alter(&$items) {
  $items['administration']['tray']['toolbar_administration']['#pre_render'] = [
    'admin_toolbar_prerender_toolbar_administration_tray',
  ];
  $items['administration']['#attached']['library'][] = 'admin_toolbar/toolbar.tree';
  $items['administration_search'] = [
    "#type" => "toolbar_item",
    'tab' => [
      '#type' => 'link',
      '#title' => new TranslatableMarkup('Search'),
      '#url' => URL::fromRoute('system.admin'),
      '#attributes' => [
        'class' => [
          'toolbar-icon',
        ],
      ],
    ],
    'tray' => [
      'search' => [
        '#title' => 'Search',
        '#type' => 'textfield',
        '#size' => 60,
        '#attributes' => [
          'id' => 'admin-toolbar-search-input',
          'aria-labelledby' => 'toolbar-item-administration-search',
        ],
      ],
    ],
    '#attached' => [
      'library' => [
        'admin_toolbar/search',
      ],
    ],
    '#wrapper_attributes' => [
      "id" => "admin-toolbar-search-tab",
    ],
  ];
}