function olivero_preprocess_form_element in Drupal 10
Same name and namespace in other branches
- 9 core/themes/olivero/olivero.theme \olivero_preprocess_form_element()
Implements hook_preprocess_form_element().
File
- core/
themes/ olivero/ olivero.theme, line 255 - Functions to support theming in the Olivero theme.
Code
function olivero_preprocess_form_element(&$variables) {
if (in_array($variables['element']['#type'] ?? FALSE, [
'checkbox',
'radio',
], TRUE)) {
$variables['attributes']['class'][] = 'form-type-boolean';
}
if (!empty($variables['description']['attributes'])) {
$variables['description']['attributes']
->addClass('form-item__description');
}
if ($variables['disabled']) {
$variables['label']['#attributes']['class'][] = 'is-disabled';
}
}