{% extends "DI/base.html.twig" %} {% set aPageAction = { reset: { rank: 2, type: 'reset', label: 'Reset', form: 'object_form' }, submit: { rank: 3, type: 'submit', label: 'Save', form: 'object_form', primary: true } } %} {% if id != 0 %} {% set aPageAction = aPageAction|merge({ previous: { rank: 0, type: 'link', disabled: id <= 1, href: path('object_edit', {'class': class, 'id': id - 1}), icon: 'fa-solid fa-arrow-left' }, next: { rank: 1, type: 'link', href: path('object_edit', {'class': class, 'id': id + 1}), icon: 'fa-solid fa-arrow-right' } }) %} {% endif %} {% block title %} Object Edition {% endblock %} {% block head %} {% endblock %} {% block toasts %} {# database information toast #} {% endblock %} {% block body %} {# inject form #}
{{ form(form, {'attr': {'id' : 'object_form', 'data-object-id' : id}}) }}
{% endblock %} {% block modals %} {% endblock %} {% block ready_scripts %} {# Widget #} const oWidget = new Widget(); {# Dynamic #} const oDynamic = new Dynamic(); {# Form #} const oForm = new Form(oWidget, oDynamic); oForm.handleElement(document); {# Collection #} const oCollection = new Collection(oForm, '{{ path('object_form', {'class': 'object_class', 'id' : 0, 'name': 'form_name'}) }}', '{{ path('object_save', {'class': 'object_class', 'id' : 0, 'name': 'form_name'}) }}'); oCollection.handleElement(document); {# toast database information #} const toastLiveExample = document.getElementById('toast') const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) toastBootstrap.show(); {% endblock %}