{% if form.message %}<div class="alert">{{ form.message }}</div>{% endif %}
{% set multipart = '' %}
{% set method = form.method|upper|default('POST') %}

{% for field in form.fields %}
    {% if (method == 'POST' and field.type == 'file') %}
        {% set multipart = ' enctype="multipart/form-data"' %}
    {% endif %}
{% endfor %}

{% set action = form.action ? base_url ~ form.action : page.url %}
{% if (action == base_url_relative) %}
    {% set action = base_url_relative ~ '/' ~ page.slug %}
{% endif %}

<form name="{{ form.name }}"
      action="{{ action }}"
      method="{{ method }}"{{ multipart }}
      {% if form.classes %}class="{{ form.classes }}"{% endif %}
>

{% for field in form.fields %}
    {% set value = form.value(field.name) %}
    <div>
        {% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
    </div>
{% endfor %}

	<div class="buttons">
	{% for button in form.buttons %}
	    <button class="{{ button.classes|default('button') }}" type="{{ button.type|default('submit') }}">{{ button.value|t|default('Submit') }}</button>
	{% endfor %}
	</div>

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

{% if form.message %}<div class="alert">{{ form.message }}</div>{% endif %}
{% set multipart = '' %}
{% set method = form.method|upper|default('POST') %}

{% for field in form.fields %}
    {% if (method == 'POST' and field.type == 'file') %}
        {% set multipart = ' enctype="multipart/form-data"' %}
    {% endif %}
{% endfor %}

{% set action = form.action ? base_url ~ form.action : page.url %}
{% if (action == base_url_relative) %}
    {% set action = base_url_relative ~ '/' ~ page.slug %}
{% endif %}

<form name="{{ form.name }}"
      action="{{ action }}"
      method="{{ method }}"{{ multipart }}
      {% block form_classes %}
      {% if form.classes %}class="{{ form.classes }}"{% endif %}
      {% endblock %}
>

{% for field in form.fields %}
    {% set value = form.value(field.name) %}
    <div>
        {% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
    </div>
{% endfor %}

	<div class="buttons">
	{% for button in form.buttons %}
	    <button
            {% block button_classes %}
            class="{{ button.classes|default('button') }}"
            {% endblock %}
            type="{{ button.type|default('submit') }}"
        >
            {{ button.value|t|default('Submit') }}
        </button>
	{% endfor %}
	</div>

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

Add blocks so classes can be overridden more easily in themes
Add blocks so classes can be overridden more easily in themes
