{% use 'form_div_layout.html.twig' with
    choice_widget_collapsed as base_choice_widget_collapsed,
    checkbox_widget as base_checkbox_widget,
    radio_widget as base_radio_widget
%}
{% use 'bootstrap_3_layout.html.twig' %}

{% block choice_widget_collapsed -%}
    {% set attr = attr|merge({
        class: (attr.class|default('') ~ ' selectpicker')|trim,
        'data-style': attr['data-style']|default('btn-white'),
        'data-dropout': attr['data-dropout']|default('false')
    }) %}
    <div class="dropdown" data-toggle="dropdown">
        {{- block('base_choice_widget_collapsed') -}}
    </div>
{%- endblock %}

{% block date_widget -%}
    {% set attr = attr|merge({class: (attr.class|default('') ~ ' datepicker')|trim}) -%}
    <div class="input-group">
        {{ parent() -}}
        <label for="{{ id }}" class="input-group-addon"><i class="fa fa-calendar"></i></label>
    </div>
{%- endblock %}

{% block st_plain_date_widget -%}
    <div class="input-group">
        {{- block('form_widget_simple') -}}
    </div>
{%- endblock %}

{% block checkbox_widget -%}
    {{- block('base_checkbox_widget') -}}
{%- endblock checkbox_widget %}

{% block radio_widget -%}
    {{- block('base_radio_widget') -}}
{%- endblock radio_widget %}

{% block datalist_widget -%}
    {% set attr = attr|merge({list: attr.list|default(id ~ '_list')}) -%}
    {{ block('form_widget_simple') -}}
    <datalist id="{{ id }}_list">
        {% for choice in choices %}
            <option value="{{ choice }}"></option>
        {% endfor %}
    </datalist>
{%- endblock datalist_widget %}

{% block form_label -%}
    {%- if required -%}
        {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' st-required')|trim}) -%}
    {%- endif -%}
    {{- parent() -}}
{%- endblock form_label %}