{% load aldryn_forms_tags i18n %}

{% if field %}
    <div class="form-group{% if field.field.required %} form-required{% endif %}{% if field.errors %} has-error{% endif %}">
        {% block form_field_label %}
            <label for="{{ field.auto_id }}">
                {{ field.label }}
                {% if field.field.required %}
                    <abbr title="{% trans "Required field" %}">*</abbr>
                {% endif %}
            </label>
        {% endblock form_field_label %}
        {% block form_field %}
            {% render_form_widget field class="form-control" %}
        {% endblock form_field %}
        {% block form_field_errors %}
            {% if field.errors %}
                {% for error in field.errors %}
                    <span class="text-danger">{{ error }}</span>
                {% endfor %}
            {% endif %}
        {% endblock form_field_errors %}
    </div>
{% endif %}
