function umami_preprocess_field in Drupal 8
Same name and namespace in other branches
- 9 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_field()
Implements hook_preprocess_field().
File
- core/
profiles/ demo_umami/ themes/ umami/ umami.theme, line 31 - Functions to support theming in the Umami theme.
Code
function umami_preprocess_field(&$variables, $hook) {
$element = $variables['element'];
// Add class to label and items fields to be styled using the meta styles.
if (isset($element['#field_name'])) {
if ($element['#field_name'] == 'field_recipe_category' || $element['#field_name'] == 'field_tags' || $element['#field_name'] == 'field_difficulty') {
$variables['attributes']['class'] = 'label-items';
}
}
}