{% macro render_field(form, fields, scope) %} {% import _self as self %} {% for index, field in fields %} {%- set show_field = attribute(field, "input@") ?? field.store ?? true %} {% if field.fields %} {%- set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope -%} {{- self.render_field(form, field.fields, new_scope) }} {% else %} {% if show_field %} {%- set value = form.value(scope ~ (field.name ?? index)) -%} {% if value %} {% block field %}
{% block field_label %} {{ field.label|t|e }}: {% endblock %} {% block field_value %} {% if field.type == 'checkboxes' %} {% elseif field.type == 'checkbox' %} {{ (form.value(scope ~ field.name) == 1) ? "GRAV.YES"|t|e : "GRAV.NO"|t|e }} {% elseif field.type == 'select' %} {{ field.options[form.value(scope ~ field.name)]|e }} {% else %} {% set value = form.value(scope ~ field.name) %} {% if value is iterable %} {% else %} {{ string(value)|e|nl2br }} {% endif %} {% endif %} {% endblock %}
{% endblock %} {% endif %} {% endif %} {% endif %} {% endfor %} {% endmacro %} {% import _self as macro %} {{ macro.render_field(form, form.fields, '') }}