8.5.x theme.inc template_preprocess_breadcrumb(&$variables)
8.0.x theme.inc template_preprocess_breadcrumb(&$variables)
8.1.x theme.inc template_preprocess_breadcrumb(&$variables)
8.2.x theme.inc template_preprocess_breadcrumb(&$variables)
8.3.x theme.inc template_preprocess_breadcrumb(&$variables)
8.4.x theme.inc template_preprocess_breadcrumb(&$variables)
8.6.x theme.inc template_preprocess_breadcrumb(&$variables)

Prepares variables for breadcrumb templates.

Default template: breadcrumb.html.twig.

Parameters

array $variables: An associative array containing:

File

core/includes/theme.inc, line 1696
The theme system, which controls the output of Drupal.

Code

function template_preprocess_breadcrumb(&$variables) {
  $variables['breadcrumb'] = [];

  /** @var \Drupal\Core\Link $link */
  foreach ($variables['links'] as $key => $link) {
    $variables['breadcrumb'][$key] = [
      'text' => $link
        ->getText(),
      'url' => $link
        ->getUrl()
        ->toString(),
    ];
  }
}