function template_preprocess_uikit_badge in UIkit Components 8.3
Prrpares variables for UIkit Badge templates.
Default template: uikit-badge.html.twig.
Parameters
$variables:: An associative array containing:
- element: An associative array containing:
- #value: The value of the article.
See also
\Drupal\uikit_components\Element\UIkitBadge
https://getuikit.com/docs/badge
Related topics
File
- includes/
preprocess.inc, line 139 - Set up variables to be placed within the template (.html.twig) files.
Code
function template_preprocess_uikit_badge(&$variables) {
$element = $variables['element'];
// Set the attributes for the badge.
$variables['attributes'] = $element['#attributes'];
// Set the value for the badge, if not empty.
if (!empty($element['#value'])) {
$variables['value'] = $element['#value'];
}
}