Add passing form to the form-related hooks to make sure the form_theme is applied

This commit is contained in:
Jacob Tobiasz 2024-04-30 12:17:47 +02:00
parent bad4d6353f
commit a4ced77ac5
No known key found for this signature in database
GPG key ID: 3F84290201B006E0
4 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,7 @@
{% if form is not defined %}
{% set form = hookable_metadata.context.form %}
{% endif %}
{% form_theme form '@SyliusAdmin/Shared/form_theme.html.twig' %}
<div class="container-xl">
@ -12,7 +13,7 @@
{{ form_errors(form, sylius_test_form_attribute('form-validation-errors')) }}
{{ form_widget(form._token) }}
{% hook 'form' %}
{% hook 'form' with { form } %}
</div>
{{ form_end(form, {render_rest: hookable.configuration.render_rest|default(false)}) }}
</div>

View file

@ -3,6 +3,6 @@
{% form_theme form '@SyliusAdmin/Shared/form_theme.html.twig' %}
{{ form_start(form, {'action': path('sylius_admin_login_check'), 'attr': {'class': 'ui large loadable form', 'novalidate': 'novalidate'}}) }}
{% hook 'form' %}
{% hook 'form' with { form } %}
<input type="hidden" name="_csrf_admin_security_token" value="{{ csrf_token('admin_authenticate') }}">
{{ form_end(form, {'render_rest': false}) }}

View file

@ -25,7 +25,7 @@
{% endif %}
{{ form_start(form, {'action': path(configuration.vars.route.name|default(configuration.getRouteName('create')), configuration.vars.route.parameters|default({})), 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate', 'id': form.vars.id}}) }}
{% block form_content %}
{% hook 'form' %}
{% hook 'form' with { form } %}
{% endblock %}
{{ form_end(form, {'render_rest': renderRest}) }}
{% if renderRest %}

View file

@ -26,7 +26,7 @@
{% block form_content %}
<input type="hidden" name="_method" value="PUT"/>
{% hook 'form' %}
{% hook 'form' with { form } %}
{% endblock %}
{{ form_end(form, {'render_rest': renderRest}) }}
{% if renderRest %}