You are here

function olivero_preprocess_field in Drupal 10

Same name and namespace in other branches
  1. 9 core/themes/olivero/olivero.theme \olivero_preprocess_field()

Implements hook_preprocess_HOOK().

File

core/themes/olivero/olivero.theme, line 361
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['field_name'] !== 'user_picture') {
    $variables['attributes']['class'][] = 'wide-image';
  }
}