Skip to content

Commit

Permalink
Fix form without data id (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 authored Nov 7, 2024
2 parents 5f21365 + b1c5591 commit fbe5619
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
{% set form = hookable_metadata.context.form %}
{% endif %}

{% if resource is not defined %}
{% set resource = hookable_metadata.context.resource %}
{% endif %}

{% form_theme form '@SyliusBootstrapAdminUi/shared/form_theme.html.twig' %}

<div class="container-xl" {% if attributes is defined %} {{ attributes }} {% endif %}>
{{ form_start(form, {'attr': {'novalidate': 'novalidate', 'id': form.vars.id}}) }}
<div class="card-body">
{% if hookable_metadata.configuration.method is defined %}
<input type="hidden" name="_method" value="{{ hookable_metadata.configuration.method }}"/>
{% elseif form.vars.data.id is not null %}
{% elseif form.vars.data.id|default(null) is not null %}
<input type="hidden" name="_method" value="PUT"/>
{% endif %}
{{ form_errors(form) }}
{{ form_widget(form._token) }}

{% hook 'form' with { form } %}
{% hook 'form' with { form, resource } %}
</div>
{{ form_end(form, {render_rest: hookable_metadata.configuration.render_rest|default(false)}) }}
</div>

0 comments on commit fbe5619

Please sign in to comment.