function claro_preprocess_form_element

Same name in other branches
  1. 9 core/themes/claro/claro.theme \claro_preprocess_form_element()
  2. 8.9.x core/themes/claro/claro.theme \claro_preprocess_form_element()
  3. 10 core/themes/claro/claro.theme \claro_preprocess_form_element()

Implements hook_preprocess_form_element().

File

core/themes/claro/claro.theme, line 950

Code

function claro_preprocess_form_element(&$variables) {
    if (!empty($variables['element']['#errors'])) {
        $variables['label']['#attributes']['class'][] = 'has-error';
    }
    if ($variables['disabled']) {
        $variables['label']['#attributes']['class'][] = 'is-disabled';
        if (!empty($variables['description']['attributes'])) {
            $variables['description']['attributes']->addClass('is-disabled');
        }
    }
}

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