data.html.twig 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. {% if form.value(field.name) %}
  6. {% block field %}
  7. <div>
  8. {% block field_label %}
  9. <strong>{{ field.label|t|e }}</strong>:
  10. {% endblock %}
  11. {% block field_value %}
  12. {% if field.type == 'checkboxes' %}
  13. <ul>
  14. {% for value in form.value(field.name) %}
  15. <li>{{ field.options[value]|e }}</li>
  16. {% endfor %}
  17. </ul>
  18. {% elseif field.type == 'checkbox' %}
  19. {{ (form.value(field.name) == 1) ? "PLUGIN_FORM.YES"|t|e : "PLUGIN_FORM.NO"|t|e }}
  20. {% elseif field.type == 'select' %}
  21. {{ field.options[form.value(field.name)]|e }}
  22. {% else %}
  23. {{ string(form.value(field.name))|nl2br }}
  24. {% endif %}
  25. {% endblock %}
  26. </div>
  27. {% endblock %}
  28. {% endif %}
  29. {% else %}
  30. {% if field.fields %}
  31. {{ _self.render_field(form, field.fields) }}
  32. {% endif %}
  33. {% endif %}
  34. {% endfor %}
  35. {% endmacro %}
  36. {{ _self.render_field(form, form.fields) }}