function umami_preprocess_field

Same name in other branches
  1. 9 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_field()
  2. 10 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_field()
  3. 11.x 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

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';
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.