hook_system_breadcrumb_alter

hook_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$breadcrumb, \Drupal\Core\Routing\RouteMatchInterface $route_match, array $context)

Perform alterations to the breadcrumb built by the BreadcrumbManager.

Parameters

\Drupal\Core\Breadcrumb\Breadcrumb $breadcrumb: A breadcrumb object returned by BreadcrumbBuilderInterface::build().

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

array $context: May include the following key:

Related topics

Hooks
Define functions that alter the behavior of Drupal core.
Menu system
Define the navigation menus, local actions and tasks, and contextual links.

File

core/lib/Drupal/Core/Menu/menu.api.php, line 431
Hooks and documentation related to the menu system and links.

Code

function hook_system_breadcrumb_alter(\Drupal\Core\Breadcrumb\Breadcrumb &$breadcrumb, \Drupal\Core\Routing\RouteMatchInterface $route_match, array $context) {
  // Add an item to the end of the breadcrumb.
  $breadcrumb->addLink(\Drupal\Core\Link::createFromRoute(t('Text'), 'example_route_name'));
}
doc_Drupal
2016-10-29 09:18:29
Comments
Leave a Comment

Please login to continue.