Skip to content
Snippets Groups Projects

Issue #3230593: Textarea's form errors are hidden

1 file
+ 21
0
Compare changes
  • Side-by-side
  • Inline
+ 21
0
@@ -715,3 +715,24 @@ function bootstrap_barrio_preprocess_input(&$variables) {
$variables['safe_value_label'] = Xss::filter($variables['attributes']['value']);
}
}
/**
* Implements hook_preprocess_textarea() for adding classes to textareas.
*
* hook_preprocess_input() hook does not launched for textareas.
*/
function bootstrap_barrio_preprocess_textarea(&$variables) {
if (isset($variables['attributes']['class'])) {
if (is_object($variables['attributes']['class'])) {
if (in_array('error', $variables['attributes']['class']->value())) {
$variables['wrapper_attributes']->addClass('is-invalid');
}
}
elseif (is_array($variables['attributes']['class'])) {
if (in_array('error', $variables['attributes']['class'])) {
$variables['wrapper_attributes']['class'][] = 'is-invalid';
}
}
}
}
Loading