passing option backUrl from include template twig

This commit is contained in:
Mathieu Jaumotte 2021-08-06 21:46:10 +02:00
parent cdbd97e595
commit 47d704b521
2 changed files with 9 additions and 3 deletions

View File

@ -5,7 +5,12 @@
window.mode = '{{ mode|e('js') }}';
window.personId = {{ person.id|e('js') }};
window.addressId = {{ address_id|e('js') }};
window.backUrl = '{{ path('chill_person_view', { 'person_id': person.id })|e('js') }}';
{% if backUrl is defined %}
window.backUrl = '{{ backUrl|e('js') }}';
{% else %}
window.backUrl = '{{ path('chill_person_address_list', { 'person_id': person.id })|e('js') }}';
{% endif %}
{% if modalTitle is defined %}
window.modalTitle = '{{ modalTitle|trans|e('js') }}';
{% endif %}
@ -23,10 +28,10 @@
window.button.display = false;
{% endif %}
{% if binModalStep1 is defined and binModalStep1 == false %}
window.binModalStep1 = false
window.binModalStep1 = false;
{% endif %}
{% if binModalStep2 is defined and binModalStep2 == false %}
window.binModalStep2 = false
window.binModalStep2 = false;
{% endif %}
</script>

View File

@ -203,6 +203,7 @@ This view should receive those arguments:
{# include vue_address component #}
{% include '@ChillPerson/Address/_insert_vue_address.html.twig' with {
address_id: person.lastAddress.id,
backUrl: path('chill_person_view', { 'person_id': person.id }),
mode: 'edit',
modalTitle: 'Edit address',
buttonText: 'Edit address',