blueprints.html.twig 1.1 KB

1234567891011121314151617181920212223242526272829
  1. {% set form_id = form_id ? form_id : 'blueprints' %}
  2. {% set scope = scope ?: 'data.' %}
  3. {% if admin.findFormFields('file', blueprints.fields) %}
  4. {% set multipart = ' enctype="multipart/form-data"' %}
  5. {% endif %}
  6. <form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true"{{ multipart|raw }}>
  7. {% for field in blueprints.fields %}
  8. {% if field.type %}
  9. {% set value = field.name ? data.value(field.name) : data.toArray %}
  10. <div class="block block-{{ field.type }}">
  11. {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
  12. </div>
  13. {% endif %}
  14. {% endfor %}
  15. {% if data.extra %}
  16. {% for name, value in data.extra %}
  17. {% if name not in ['_json','task','admin-nonce'] %}
  18. {% set field = {name: '_json.' ~ name} %}
  19. {% set value = value|raw|json_encode %}
  20. {% include 'forms/fields/hidden/hidden.html.twig' %}
  21. {% endif %}
  22. {% endfor %}
  23. {% endif %}
  24. {{ nonce_field('admin-form', 'admin-nonce')|raw }}
  25. </form>