Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. theme.inc

function template_preprocess_breadcrumb

Prepares variables for breadcrumb templates.

Default template: breadcrumb.html.twig.

Parameters

array $variables: An associative array containing:

  • links: A list of \Drupal\Core\Link objects which should be rendered.

File

core/includes/theme.inc, line 1574

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal