Url::fromRoute('help.page', ['name' => 'toolbar'])->toString(), ':automated_cron' => (\Drupal::moduleHandler()->moduleExists('automated_cron')) ? Url::fromRoute('help.page', ['name' => 'automated_cron'])->toString() : '#', ]; $output = ''; $output .= '

' . t('About') . '

'; $output .= '

' . t('The Admin Toolbar module enhances the Toolbar module by providing fast access to all the administrative links at the top of your site. Admin Toolbar remains a very "lightweight" module by closely integrating with all Toolbar functionality. It can be used in conjunction with all the sub modules included on Admin Toolbar, for quick access to system commands such as Flush all caches, Run cron, Run Updates, etc.', $variables) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '

' . t('The Admin Toolbar greatly improves the user experience for those who regularly interact with the site Toolbar by providing fast, full access to all links in the site Toolbar without having to click to get there.') . '

'; return $output; } } /** * Renders the toolbar's administration tray. * * This is a clone of core's toolbar_prerender_toolbar_administration_tray() * function, which uses setMaxDepth(4) instead of setTopLevelOnly(). * * @param array $element * A renderable array. * * @return array * The updated renderable array. * * @see toolbar_prerender_toolbar_administration_tray() */ function admin_toolbar_prerender_toolbar_administration_tray(array $element) { $menu_tree = \Drupal::service('toolbar.menu_tree'); $parameters = new MenuTreeParameters(); $parameters->setRoot('system.admin')->excludeRoot()->setMaxDepth(4)->onlyEnabledLinks(); $tree = $menu_tree->load(NULL, $parameters); $manipulators = [ ['callable' => 'menu.default_tree_manipulators:checkAccess'], ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'], ['callable' => 'toolbar_tools_menu_navigation_links'], ]; $tree = $menu_tree->transform($tree, $manipulators); $element['administration_menu'] = $menu_tree->build($tree); return $element; } /** * Adds toolbar-specific attributes to the menu link tree. * * @param \Drupal\Core\Menu\MenuLinkTreeElement[] $tree * The menu link tree to manipulate. * * @return \Drupal\Core\Menu\MenuLinkTreeElement[] * The manipulated menu link tree. */ function toolbar_tools_menu_navigation_links(array $tree) { foreach ($tree as $element) { if ($element->subtree) { toolbar_tools_menu_navigation_links($element->subtree); } $link = $element->link; // Get the non-localized title to make the icon class. $definition = $link->getPluginDefinition(); $element->options['attributes']['class'][] = 'toolbar-icon'; $string = strtolower(str_replace(['.', ' ', '_'], ['-', '-', '-'], $definition['id'])); $element->options['attributes']['class'][] = Html::cleanCssIdentifier('toolbar-icon-' . $string); $element->options['attributes']['title'] = $link->getDescription(); } return $tree; }