function claro_preprocess_form_element

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

Implements hook_preprocess_form_element().

File

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

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.