<commit_before>{% set form_id = form_id ? form_id : 'blueprints' %}

<form id="{{ form_id }}" method="post" data-grav-form="{{ form_id }}" data-grav-keepalive="true">
    {% 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>
<commit_msg>If a field of the form is file, add enctype attribute with multipart/form-data<commit_after>{% 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>

{'fraction_non_alphanumeric': 0.20030503304524658, 'fraction_numerical': 0.0, 'mean_word_length': 2.446584938704028, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6714848', 'n_tokens_mistral': 709, 'n_tokens_neox': 628, 'n_words': 135}