function ShortcutLazyBuilder::lazyLinks
Same name in other branches
- 10 core/modules/navigation/src/ShortcutLazyBuilder.php \Drupal\navigation\ShortcutLazyBuilder::lazyLinks()
The #lazy_builder callback; builds shortcut navigation links.
Parameters
string $label: (Optional) The links label. Defaults to "Shortcuts".
Return value
array A renderable array of shortcut links.
File
-
core/
modules/ navigation/ src/ ShortcutLazyBuilder.php, line 44
Class
- ShortcutLazyBuilder
- Lazy Builders for Navigation shortcuts links.
Namespace
Drupal\navigationCode
public function lazyLinks(string $label = 'Shortcuts') {
$shortcut_links = $this->shortcutLazyBuilder
->lazyLinks();
if (empty($shortcut_links['shortcuts']['#links'])) {
return [
'#cache' => $shortcut_links['#cache'],
];
}
$shortcuts_items = [
[
'title' => $label,
'class' => 'shortcuts',
'below' => $shortcut_links['shortcuts']['#links'],
],
];
return [
'#theme' => 'navigation_menu',
'#menu_name' => 'shortcuts',
'#title' => $label,
'#items' => $shortcuts_items,
'#cache' => $shortcut_links['#cache'],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.