You are here

function umami_preprocess_field in Drupal 9

Same name and namespace in other branches
  1. 8 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 32
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';
    }
  }
}