class BreadcrumbPreprocess
Breadcrumb theme preprocess.
@internal
Hierarchy
- class \Drupal\Core\Breadcrumb\BreadcrumbPreprocess
Expanded class hierarchy of BreadcrumbPreprocess
2 files declare their use of BreadcrumbPreprocess
- theme.inc in core/
includes/ theme.inc - The theme system, which controls the output of Drupal.
- ThemeCommonElements.php in core/
lib/ Drupal/ Core/ Theme/ ThemeCommonElements.php
1 string reference to 'BreadcrumbPreprocess'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses BreadcrumbPreprocess
File
-
core/
lib/ Drupal/ Core/ Breadcrumb/ BreadcrumbPreprocess.php, line 10
Namespace
Drupal\Core\BreadcrumbView source
class BreadcrumbPreprocess {
/**
* Prepares variables for breadcrumb templates.
*
* Default template: breadcrumb.html.twig.
*
* @param array $variables
* An associative array containing:
* - links: A list of \Drupal\Core\Link objects which should be rendered.
*/
public function preprocessBreadcrumb(array &$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(),
];
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
BreadcrumbPreprocess::preprocessBreadcrumb | public | function | Prepares variables for breadcrumb templates. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.