{% 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 class="control-label{% if not field.label %} sr-only{% endif %}" for="{{ field.id_for_label }}">
                {{ field.label }}{% if field.field.required %}<abbr title="{% trans "Required field" %}">*</abbr>{% endif %}
            </label>
        {% endblock form_field_label %}

        {% block form_field %}
            <div class="control-field">
                {% render_form_widget field class="form-control" %}

                {% block form_field_errors %}
                    {% if field.errors %}
                        {% for error in field.errors %}<span class="text-danger">{{ error }}</span>{% endfor %}
                    {% endif %}
                {% endblock form_field_errors %}

                {% block form_field_help_text %}
                    {% if field.help_text %}<span class="help-block">{{ field.help_text }}</span>{% endif %}
                {% endblock form_field_help_text %}
            </div>
        {% endblock form_field %}
    </div>
{% endif %}
