You are here

breadcrumb_manager.api.php in Breadcrumb Manager 8

Same filename and directory in other branches
  1. 7 breadcrumb_manager.api.php

Breadcrumb Manager API documentation.

File

breadcrumb_manager.api.php
View source
<?php

/**
 * @file
 * Breadcrumb Manager API documentation.
 */

/**
 * @addtogroup hooks
 * @{
 */
use Drupal\Core\Url;

/**
 * Implements hook_breadcrumb_manager_fake_segments_alter().
 */
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']);
  }
}