],
],
'#wrapper_attributes' => [
- 'class' => ['hidden', 'home-toolbar-tab'],
+ 'class' => ['home-toolbar-tab'],
],
'#attached' => [
'library' => [
return $tree;
}
+/**
+ * Implements hook_preprocess_HOOK() for HTML document templates.
+ */
+function toolbar_preprocess_html(&$variables) {
+ if (!\Drupal::currentUser()->hasPermission('access toolbar')) {
+ return;
+ }
+
+ $variables['attributes'] = new Attribute($variables['attributes']);
+ $variables['attributes']->addClass(['toolbar-tray-open', 'toolbar-horizontal', 'toolbar-fixed', 'toolbar-loading']);
+}
+
/**
* Returns the rendered subtree of each top-level toolbar link.
*
// Many routes have dots as route name, while some special ones like <front>
// have <> characters in them.
$url = $link->getUrlObject();
- $id = str_replace(['.', '<', '>'], ['-', '', '' ], $url->isRouted() ? $url->getRouteName() : $url->getUri());
+ $id = str_replace(['.', '<', '>'], ['-', '', ''], $url->isRouted() ? $url->getRouteName() : $url->getUri());
$subtrees[$id] = $output;
}