diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index dc4858e2f3871..81297e537c6eb 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -115,8 +115,12 @@ {%- endblock percent_widget %} {% block form_widget_simple -%} + {% if use_bootstrap_custom is not defined %} + {% set use_bootstrap_custom = true %} + {% endif %} + {% if type is not defined or type != 'hidden' %} - {%- set attr = attr|merge({class: (attr.class|default('') ~ (type|default('') == 'file' ? ' custom-file-input' : ' form-control'))|trim}) -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ (type|default('') == 'file' and use_bootstrap_custom ? ' custom-file-input' : ' form-control'))|trim}) -%} {% endif %} {%- if type is defined and (type == 'range' or type == 'color') %} {# Attribute "required" is not supported #} @@ -138,8 +142,12 @@ {%- endblock button_widget %} {% block checkbox_widget -%} + {% if use_bootstrap_custom is not defined %} + {% set use_bootstrap_custom = true %} + {% endif %} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} - {%- if 'checkbox-custom' in parent_label_class -%} + {%- if 'checkbox-custom' in parent_label_class and use_bootstrap_custom -%} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%}