Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. olivero.theme

function olivero_preprocess_field

Implements hook_preprocess_HOOK().

File

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

Code

function olivero_preprocess_field(&$variables) : void {
    $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';
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal