{% set form_id = form_id ? form_id : 'blueprints' %}

{% set multipart = '' %}
{% for field in blueprints.fields %}
    {% if field.type == 'file' %}
        {% set multipart = ' enctype="multipart/form-data"' %}
    {% endif %}
{% endfor %}

<form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true"{{ multipart }}>
    {% for field in blueprints.fields %}
        {% if field.type %}
            {% set value = data.value(field.name) %}

            <div class="block block-{{ field.type }}">
                {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
            </div>
        {% endif %}
    {% endfor %}

    {% if data.extra %}
    {% for name, value in data.extra %}
        {% set field = {name: '_json.' ~ name} %}
        {% set value = value|json_encode|e %}
        {% include 'forms/fields/hidden/hidden.html.twig' %}
    {% endfor %}
    {% endif %}

    {{ nonce_field('admin-form', 'admin-nonce') }}
</form>

{% set form_id = form_id ? form_id : 'blueprints' %}

{% set multipart = '' %}
{% for field in blueprints.fields %}
    {% if field.type == 'file' %}
        {% set multipart = ' enctype="multipart/form-data"' %}
    {% endif %}
{% endfor %}

<form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true"{{ multipart }}>
    {% for field in blueprints.fields %}
        {% if field.type %}
            {% set value = data.value(field.name) %}

            <div class="block block-{{ field.type }}">
                {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
            </div>
        {% endif %}
    {% endfor %}

    {% if data.extra %}
    {% for name, value in data.extra %}
        {% if name not in ['_json','task','admin-nonce'] %}
            {% set field = {name: '_json.' ~ name} %}
            {% set value = value|json_encode|e %}
            {% include 'forms/fields/hidden/hidden.html.twig' %}
        {% endif %}
    {% endfor %}
    {% endif %}

    {{ nonce_field('admin-form', 'admin-nonce') }}
</form>

Fix for multiple nonces/_json/task fields etc.
Fix for multiple nonces/_json/task fields etc.
