{% extends "forms/field.html.twig" %}

{% block field %}
{% if field.security is empty or authorize(array(field.security)) %}

    {% if field.title or field.underline %}
    <h1 class="{{ field.classes }} {{ field.underline ?: 'no_underline' }}">{% if grav.twig.twig.filters['tu'] is defined %}{{ field.title|tu }}{% else %}{{ field.title|t }}{% endif %}</h1>
    {% endif %}

    {% if field.text %}
    <p>{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}</p>
    {% endif %}

    {% if field.fields %}
        <div class="form-section {{ field.field_classes }} {{ field.outer_classes }}">
        {% for field in field.fields %}
            {% if field.type %}
                {% set value = field.name ? data.value(field.name) : data.toArray %}
                {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
            {% endif %}
        {% endfor %}
        </div>
    {% endif %}

{% endif %}
{% endblock %}
