function olivero_preprocess_field

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

Implements hook_preprocess_HOOK().

File

core/themes/olivero/olivero.theme, line 361

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

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