data.txt.twig 619 B

12345678910111213141516
  1. {%- macro render_field(form, fields) %}
  2. {%- for index, field in fields %}
  3. {%- set input = attribute(field, "input@") %}
  4. {%- if input is null or input == true %}
  5. {%- set value = form.value(field.name ?? index) %}
  6. {{- field.name ?? index }}: {{ string(value is iterable ? value|json_encode : value|escape('yaml')) ~ "\r\n" }}
  7. {%- else %}
  8. {%- if field.fields %}
  9. {{- _self.render_field(form, field.fields) }}
  10. {%- endif %}
  11. {%- endif %}
  12. {%- endfor %}
  13. {%- endmacro %}
  14. {%- autoescape false %}
  15. {{- _self.render_field(form, form.fields) ~ "\r\n" }}
  16. {%- endautoescape %}