data.txt.twig 836 B

123456789101112131415161718192021
  1. {%- macro render_field(form, fields, scope) %}
  2. {%- import _self as self %}
  3. {%- for index, field in fields %}
  4. {%- set show_field = attribute(field, "input@") ?? field.store ?? true %}
  5. {%- if field.fields %}
  6. {%- set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope -%}
  7. {{- self.render_field(form, field.fields, new_scope) }}
  8. {%- else %}
  9. {%- if show_field %}
  10. {%- set value = form.value(scope ~ (field.name ?? index)) -%}
  11. {%- if value -%}
  12. {{- field.label }}: {{ string(value is iterable ? value|json_encode : value|e) ~ "\r\n" }}
  13. {%- endif -%}
  14. {%- endif %}
  15. {%- endif %}
  16. {%- endfor %}
  17. {%- endmacro %}
  18. {%- import _self as macro %}
  19. {%- autoescape false %}
  20. {{- macro.render_field(form, form.fields, '') ~ "\r\n" }}
  21. {%- endautoescape %}