first commit
This commit is contained in:
41
templates/Kernel/partials/_admin_create_box.twig
Normal file
41
templates/Kernel/partials/_admin_create_box.twig
Normal file
@@ -0,0 +1,41 @@
|
||||
{#
|
||||
Boîte d'ajout réutilisable dans l'admin.
|
||||
|
||||
Usage type :
|
||||
{% embed '@Kernel/partials/_admin_create_box.twig' with {
|
||||
title: 'Ajouter un élément',
|
||||
hint: 'Le contenu de la boîte est piloté par le module consommateur.',
|
||||
form: { action: '/admin/items/create' }
|
||||
} %}
|
||||
{% block fields %}...{% endblock %}
|
||||
{% block actions %}...{% endblock %}
|
||||
{% endembed %}
|
||||
#}
|
||||
|
||||
{% set form = form|default({}) %}
|
||||
{% set extra = form.extra|default({}) %}
|
||||
|
||||
<div class="admin-create">
|
||||
<h3 class="admin-create__title">{{ title }}</h3>
|
||||
|
||||
<form
|
||||
{% if form.id is defined %}id="{{ form.id }}"{% endif %}
|
||||
method="{{ form.method|default('post') }}"
|
||||
{% if form.action is defined %}action="{{ form.action }}"{% endif %}
|
||||
{% if form.enctype is defined %}enctype="{{ form.enctype }}"{% endif %}
|
||||
class="admin-create__form{% if form.class is defined %} {{ form.class }}{% endif %}"
|
||||
{% for name, value in extra %} {{ name }}="{{ value }}"{% endfor %}
|
||||
>
|
||||
{% include '@Kernel/partials/_csrf_fields.twig' %}
|
||||
|
||||
{% block fields %}{% endblock %}
|
||||
|
||||
<div class="admin-create__actions">
|
||||
{% block actions %}{% endblock %}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if hint is defined and hint %}
|
||||
<p class="admin-create__hint">{{ hint }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user