function ClaroHooks::preprocessFormElement
Implements hook_preprocess_form_element().
Attributes
#[Hook('preprocess_form_element')]
File
-
core/
themes/ claro/ src/ Hook/ ClaroHooks.php, line 730
Class
- ClaroHooks
- Hook implementations for claro.
Namespace
Drupal\claro\HookCode
public function preprocessFormElement(&$variables) : void {
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.