function template_preprocess_uikit_description_list in UIkit Components 8.3
Prepares variables for UIkit Description List templates.
Default template: uikit-description.html.twig.
Parameters
$variables: An associative array containing:
- element: An associative array containing:
- #items: An array of items to be displayed in the description list. Each item can be an associative array with the properties "term" and "description", or be a string if the definition should be displayed with the previous item's term.
- #divider: A boolean indicating whether to add a horizontal line between list items. Defaults to FALSE.
See also
\Drupal\uikit_components\Element\UIkitDescriptionList
https://getuikit.com/docs/description-list
Related topics
File
- includes/
preprocess.inc, line 409 - Set up variables to be placed within the template (.html.twig) files.
Code
function template_preprocess_uikit_description_list(&$variables) {
$element = $variables['element'];
// Set the attributes for the description list.
$variables['attributes'] = $element['#attributes'];
// Set the items property.
$variables['items'] = [];
foreach ($element['#items'] as $key => $item) {
$variables['items'][$key] = $item;
}
}