You are here

function template_preprocess_uikit_breadcrumb in UIkit Components 8.3

Prepares variables for UIkit Breadcrumb templates.

Default template: uikit-breadcrumb.html.twig.

Parameters

$variables: An associative array containing:

  • element: An associative array containing:

    • #items: An array of items to be displayed in the breadcrumb. Each item must contain the text property and can optionally contain the url property to display the item as a link. Each item can also contain a disabled property to set the item as disabled using 'disabled' => TRUE.

See also

\Drupal\uikit_components\Element\UIkitBreadcrumb

https://getuikit.com/docs/breadcrumb

Related topics

File

includes/preprocess.inc, line 169
Set up variables to be placed within the template (.html.twig) files.

Code

function template_preprocess_uikit_breadcrumb(&$variables) {
  $element = $variables['element'];

  // Set the attributes for the breadcrumb.
  $variables['attributes'] = $element['#attributes'];

  // Set the items property.
  $variables['items'] = [];
  foreach ($element['#items'] as $key => $item) {
    $variables['items'][$key] = $item;
  }
}