You are here

function olivero_preprocess_field in Drupal 9

Implements hook_preprocess_HOOK().

File

core/themes/olivero/olivero.theme, line 355
Functions to support theming in the Olivero theme.

Code

function olivero_preprocess_field(&$variables) {
  $rich_field_types = [
    'text_with_summary',
    'text',
    'text_long',
  ];
  if (in_array($variables['field_type'], $rich_field_types, TRUE)) {
    $variables['attributes']['class'][] = 'text-content';
  }
  if ($variables['field_type'] == 'image' && $variables['element']['#view_mode'] == 'full' && !$variables["element"]["#is_multiple"]) {
    $variables['attributes']['class'][] = 'wide-image';
  }
}