function template_preprocess_breadcrumb

Same name and namespace in other branches
  1. 9 core/includes/theme.inc \template_preprocess_breadcrumb()
  2. 8.9.x core/includes/theme.inc \template_preprocess_breadcrumb()
  3. 10 core/includes/theme.inc \template_preprocess_breadcrumb()

Prepares variables for breadcrumb templates.

Default template: breadcrumb.html.twig.

Parameters

array $variables: An associative array containing:

File

core/includes/theme.inc, line 1592

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(),
        ];
    }
}

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