You are here

function claro_preprocess_select in Drupal 9

Same name and namespace in other branches
  1. 8 core/themes/claro/claro.theme \claro_preprocess_select()
  2. 10 core/themes/claro/claro.theme \claro_preprocess_select()

Implements template_preprocess_HOOK() for select.

File

core/themes/claro/claro.theme, line 829
Functions to support theming in the Claro theme.

Code

function claro_preprocess_select(&$variables) {
  if (!empty($variables['element']['#title_display']) && $variables['element']['#title_display'] === 'attribute' && !empty((string) $variables['element']['#title'])) {
    $variables['attributes']['title'] = (string) $variables['element']['#title'];
  }
  $variables['attributes']['class'][] = 'form-element';
  $variables['attributes']['class'][] = $variables['element']['#multiple'] ? 'form-element--type-select-multiple' : 'form-element--type-select';
  if (in_array('block-region-select', $variables['attributes']['class'])) {
    $variables['attributes']['class'][] = 'form-element--extrasmall';
  }
}