X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftoolbar%2Ftoolbar.module;h=c7feaee2379779d3ef605cfbbc6ecbc4d2fc61a8;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=4791f87f97847c9bb555ac950d360bb3b653e99a;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/toolbar/toolbar.module b/web/core/modules/toolbar/toolbar.module index 4791f87f9..c7feaee23 100644 --- a/web/core/modules/toolbar/toolbar.module +++ b/web/core/modules/toolbar/toolbar.module @@ -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 // 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; }