function menu_ui_system_breadcrumb_alter in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/menu_ui/menu_ui.module \menu_ui_system_breadcrumb_alter()
Implements hook_system_breadcrumb_alter().
File
- core/
modules/ menu_ui/ menu_ui.module, line 489 - Allows administrators to customize the site's navigation menus.
Code
function menu_ui_system_breadcrumb_alter(Breadcrumb &$breadcrumb, RouteMatchInterface $route_match, array $context) {
// Custom breadcrumb behavior for editing menu links, we append a link to
// the menu in which the link is found.
if ($route_match
->getRouteName() == 'menu_ui.link_edit' && ($menu_link = $route_match
->getParameter('menu_link_plugin'))) {
if ($menu_link instanceof MenuLinkInterface) {
// Add a link to the menu admin screen.
$menu = Menu::load($menu_link
->getMenuName());
$breadcrumb
->addLink(Link::createFromRoute($menu
->label(), 'entity.menu.edit_form', [
'menu' => $menu
->id(),
]));
}
}
}