I am using bootstrap form theming. This is my fields.html.twig form template:
{% block form_row %}
{% spaceless %}
<div class="form-group {% if errors|length > 0 %}has-error{% endif %}">
{{ form_label(form, label|default(null), { 'label_attr': {'class': 'control-label'} }) }}
{{ form_errors(form) }}
{% set class='' %}
{% if attr.class is defined %}
{% set class = attr.class %}
{% endif %}
{{ form_widget(form, { 'attr': {'class': 'form-control ' ~ class} }) }}
</div>
{% endspaceless %}
{% endblock form_row %}
The problem is that it does not respect checkboxes. It renders checkboxes like normal input fields. Any idea how to setup a template for checkboxes based on the above template?
$builder->addpart where you add this form field? Do you have fields.html.twig defined in yourconfig.ymlas atwigresource?attr[class]=checkboxto your field?