function toolbar_page_top
Same name in other branches
- 9 core/modules/toolbar/toolbar.module \toolbar_page_top()
- 8.9.x core/modules/toolbar/toolbar.module \toolbar_page_top()
Implements hook_page_top().
Add admin toolbar to the top of the page automatically.
File
-
core/
modules/ toolbar/ toolbar.module, line 56
Code
function toolbar_page_top(array &$page_top) {
$page_top['toolbar'] = [
'#type' => 'toolbar',
'#access' => \Drupal::currentUser()->hasPermission('access toolbar'),
'#cache' => [
'keys' => [
'toolbar',
],
'contexts' => [
'user.permissions',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.