{% extends 'form_div_layout.html.twig' %}

{% block textarea_widget %}
{% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
{{ parent() }}
{% endblock textarea_widget %}

{% block form_widget_simple %}
{% spaceless %}
    {% set attr = attr|merge({'class': attr.class|default('') ~ ' form-control'}) %}
    {% set type = type|default('text') %}

    {{ parent() }}
{% endspaceless %}
{% endblock form_widget_simple %}

{% block form_row %}
{% spaceless %}
    <div class="form-group{% if errors|length > 0 %} has-error{% endif %}">
        {{ form_label(form) }}

        {{ form_widget(form) }}

        {% for error in errors %}
            <span class="help-block form-error">
                {{
                    error.messagePluralization is null
                    ? error.messageTemplate|trans(error.messageParameters, 'validators')
                    : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators')
                }}
            </span>
        {% endfor %}
    </div>
{% endspaceless %}
{% endblock form_row %}

{% block form_errors %}
{% spaceless %}
    {% if errors|length > 0 %}
        {% for error in errors %}
            <div class="alert alert-danger">{{ error.message }}</div>
        {% endfor %}
    {% endif %}
{% endspaceless %}
{% endblock form_errors %}
