function hook_system_breadcrumb_alter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/menu.api.php \hook_system_breadcrumb_alter()
  2. 8.9.x core/lib/Drupal/Core/Menu/menu.api.php \hook_system_breadcrumb_alter()
  3. 10 core/lib/Drupal/Core/Menu/menu.api.php \hook_system_breadcrumb_alter()

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

1 invocation of hook_system_breadcrumb_alter()
BreadcrumbManager::build in core/lib/Drupal/Core/Breadcrumb/BreadcrumbManager.php
Builds the breadcrumb.

File

core/lib/Drupal/Core/Menu/menu.api.php, line 443

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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.