blueprints.html.twig 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. {% set blueprints = blueprints ?? form.blueprint %}
  2. {% set data = data ?? form.data %}
  3. {% set form_id = form_id ?? 'blueprints' %}
  4. {% set scope = scope ?: 'data.' %}
  5. {% set field_layout = 'admin' %}
  6. {% if admin.findFormFields('file', blueprints.fields) %}
  7. {% set multipart = ' enctype="multipart/form-data"' %}
  8. {% endif %}
  9. <form {% if form_action %}action="{{ form_action }}"{% endif %} id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" {% if form.novalidate %}novalidate{% endif %} data-grav-keepalive="true"{{ multipart|raw }}>
  10. {% embed 'forms/default/fields.html.twig' with {name: null, fields: blueprints.fields} %}
  11. {% block inner_markup_field_open %}<div class="block block-{{ field.type }}">{% endblock %}
  12. {% block inner_markup_field_close %}</div>{% endblock %}
  13. {% endembed %}
  14. {% if data.extra %}
  15. {% for name, value in data.extra %}
  16. {% if name not in ['_json','task','admin-nonce'] %}
  17. {% set field = {name: '_json.' ~ name} %}
  18. {% set value = value|json_encode %}
  19. {% include 'forms/fields/hidden/hidden.html.twig' %}
  20. {% endif %}
  21. {% endfor %}
  22. {% endif %}
  23. {% if form %}
  24. {% include "forms/fields/formname/formname.html.twig" %}
  25. {% include 'forms/fields/uniqueid/uniqueid.html.twig' %}
  26. {{ nonce_field(form.getNonceAction(), form.getNonceName())|raw }}
  27. {% else %}
  28. {{ nonce_field('admin-form', 'admin-nonce')|raw }}
  29. {% endif %}
  30. </form>