You are here

function hook_breadcrumb_manager_fake_segments_alter in Breadcrumb Manager 8

Implements hook_breadcrumb_manager_fake_segments_alter().

1 invocation of hook_breadcrumb_manager_fake_segments_alter()
BreadcrumbManagerBuilder::build in src/Breadcrumb/BreadcrumbManagerBuilder.php
Builds the breadcrumb.

File

./breadcrumb_manager.api.php, line 18
Breadcrumb Manager API documentation.

Code

function hook_breadcrumb_manager_fake_segments_alter($current_path, &$title, Url &$url) {
  $mapping = [
    '/fake-segment-news' => [
      'title' => 'My amazing news',
      'path' => '/news',
    ],
  ];
  if (isset($mapping[$current_path])) {
    $title = $mapping[$current_path]['title'];
    $url = Url::fromUserInput($mapping[$current_path]['path']);
  }
}