You are here

function admin_toolbar_toolbar_alter in Admin Toolbar 3.x

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

Implements hook_toolbar_alter().

File

./admin_toolbar.module, line 16
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'] = [
    [
      AdminToolbar::class,
      'preRenderTray',
    ],
  ];
  $items['administration']['#attached']['library'][] = 'admin_toolbar/toolbar.tree';
  $hoverintent_functionality = \Drupal::config('admin_toolbar_tools.settings')
    ->get('hoverintent_functionality');
  if ($hoverintent_functionality === TRUE) {

    // Use jQuery hover() effect.
    $items['administration']['#attached']['library'][] = 'admin_toolbar/toolbar.tree.hoverintent';
  }
  else {

    // User hoverIntent plugin.
    $items['administration']['#attached']['library'][] = 'admin_toolbar/toolbar.tree.hover';
  }
}