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:
- builder: the instance of \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface that constructed this breadcrumb, or NULL if no builder acted based on the current attributes.
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')); }
Please login to continue.