function toolbar_page_top

toolbar_page_top(array &$page_top)

Implements hook_page_top().

Add admin toolbar to the top of the page automatically.

File

core/modules/toolbar/toolbar.module, line 55
Administration toolbar for quick access to top level administration items.

Code

function toolbar_page_top(array &$page_top) {
  $page_top['toolbar'] = array(
    '#type' => 'toolbar',
    '#access' => \Drupal::currentUser()->hasPermission('access toolbar'),
    '#cache' => [
      'keys' => ['toolbar'],
      'contexts' => ['user.permissions'],
    ],
  );
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!toolbar!toolbar.module/function/toolbar_page_top/8.1.x