Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / toolbar / toolbar.module
index 4791f87f97847c9bb555ac950d360bb3b653e99a..c7feaee2379779d3ef605cfbbc6ecbc4d2fc61a8 100644 (file)
@@ -149,7 +149,7 @@ function toolbar_toolbar() {
       ],
     ],
     '#wrapper_attributes' => [
-      'class' => ['hidden', 'home-toolbar-tab'],
+      'class' => ['home-toolbar-tab'],
     ],
     '#attached' => [
       'library' => [
@@ -276,6 +276,18 @@ function toolbar_menu_navigation_links(array $tree) {
   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.
  *
@@ -333,7 +345,7 @@ function _toolbar_do_get_rendered_subtrees(array $data) {
     // 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;
   }