function claro_preprocess_form_element in Drupal 8
Same name and namespace in other branches
- 9 core/themes/claro/claro.theme \claro_preprocess_form_element()
- 10 core/themes/claro/claro.theme \claro_preprocess_form_element()
Implements hook_preprocess_form_element().
File
- core/
themes/ claro/ claro.theme, line 658 - Functions to support theming in the Claro theme.
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');
}
}
}