Skip to content
Snippets Groups Projects
Commit aa356319 authored by Vladimir Roudakov's avatar Vladimir Roudakov Committed by Vladimir Roudakov
Browse files

Issue #3190581 by VladimirAus: Checkbox is not styled properly

parent 93a4d901
No related branches found
No related tags found
No related merge requests found
......@@ -366,6 +366,33 @@ function bootstrap5_preprocess_textarea(&$variables) {
$variables['attributes']['class'][] = 'form-control';
}
/**
* Implements template_preprocess_HOOK() for input.
*/
function bootstrap5_preprocess_input(&$variables) {
$type_html = $variables['attributes']['type'];
$text_types_html = [
'text',
'email',
'tel',
'number',
'search',
'password',
'url',
'month',
'week',
];
if (in_array($type_html, $text_types_html)) {
$variables['attributes']['class'][] = 'form-control';
}
if (in_array($type_html, ['checkbox'])) {
$variables['attributes']['class'][] = 'form-check-input';
}
}
/**
* Implements theme_preprocess_datetime_form().
*/
......
......@@ -14,6 +14,6 @@
{% if attributes.hasClass('button') and not attributes.hasClass('field-add-more-submit') %}
<input{{ attributes.addClass('btn btn-primary') }} />
{% else %}
<input{{ attributes.addClass('form-control') }} />
<input{{ attributes }} />
{% endif %}
{{ children }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment