function hook_system_breadcrumb_alter in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/menu.api.php \hook_system_breadcrumb_alter()
- 9 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:
- 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
3 functions implement hook_system_breadcrumb_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- layout_builder_system_breadcrumb_alter in core/
modules/ layout_builder/ layout_builder.module - Implements hook_system_breadcrumb_alter().
- layout_builder_test_system_breadcrumb_alter in core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ layout_builder_test.module - Implements hook_system_breadcrumb_alter().
- menu_ui_system_breadcrumb_alter in core/
modules/ menu_ui/ menu_ui.module - Implements hook_system_breadcrumb_alter().
1 invocation of hook_system_breadcrumb_alter()
- BreadcrumbManager::build in core/
lib/ Drupal/ Core/ Breadcrumb/ BreadcrumbManager.php
File
- core/
lib/ Drupal/ Core/ Menu/ menu.api.php, line 442 - 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'));
}