function gin_toolbar_tools_menu_navigation_links in Gin Toolbar 8
Adds toolbar-specific attributes to the menu link tree.
Parameters
\Drupal\Core\Menu\MenuLinkTreeElement[] $tree: The menu link tree to manipulate.
Return value
\Drupal\Core\Menu\MenuLinkTreeElement[] The manipulated menu link tree.
1 string reference to 'gin_toolbar_tools_menu_navigation_links'
- GinToolbar::preRenderTray in src/
Render/ Element/ GinToolbar.php - Renders the toolbar's administration tray.
File
- ./
gin_toolbar.module, line 188 - gin_toolbar.module
Code
function gin_toolbar_tools_menu_navigation_links(array $tree) {
foreach ($tree as $element) {
if ($element->subtree) {
gin_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;
}