forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasyncform-listen-to-bs-event.diff
33 lines (32 loc) · 1.19 KB
/
asyncform-listen-to-bs-event.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/assets/controllers/modal-form_controller.js b/assets/controllers/modal-form_controller.js
index a59fd79..5267dd5 100644
--- a/assets/controllers/modal-form_controller.js
+++ b/assets/controllers/modal-form_controller.js
@@ -32,4 +32,8 @@ export default class extends Controller {
this.modalBodyTarget.innerHTML = e.responseText;
}
}
+
+ modalHidden() {
+ console.log('it was hidden!');
+ }
}
diff --git a/templates/product_admin/index.html.twig b/templates/product_admin/index.html.twig
index 93d133f..0727b11 100644
--- a/templates/product_admin/index.html.twig
+++ b/templates/product_admin/index.html.twig
@@ -7,9 +7,12 @@
<div class="d-flex flex-row">
<h1 class="me-3">Product index</h1>
- <div {{ stimulus_controller('modal-form', {
- formUrl: path('product_admin_new')
- }) }}>
+ <div
+ {{ stimulus_controller('modal-form', {
+ formUrl: path('product_admin_new')
+ }) }}
+ data-action="hidden.bs.modal->modal-form#modalHidden"
+ >
<button
class="btn btn-primary btn-sm"
data-action="modal-form#openModal"