public static function UIkitBreadcrumb::preRenderUIkitBreadcrumb in UIkit Components 8.3
Pre-render callback: Sets the breadcrumb attributes.
Doing so during pre_render gives modules a chance to alter the breadcrumb.
Parameters
array $element: A renderable array.
Return value
array A renderable array.
File
- src/
Element/ UIkitBreadcrumb.php, line 77
Class
- UIkitBreadcrumb
- Provides a render element for the Breadcrumb component.
Namespace
Drupal\uikit_components\ElementCode
public static function preRenderUIkitBreadcrumb($element) {
// Set the attributes for the breadcrumb outer element.
$element['#attributes']
->addClass('uk-breadcrumb');
foreach ($element['#items'] as $key => $item) {
// Set the item attributes.
$item_attributes = new Attribute();
if (isset($item['disabled']) && $item['disabled']) {
$item_attributes
->addClass('uk-disabled');
}
$element['#items'][$key]['attributes'] = $item_attributes;
}
return $element;
}