forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodal-add-formurl-value.diff
32 lines (29 loc) · 1.15 KB
/
modal-add-formurl-value.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
diff --git a/assets/controllers/modal-form_controller.js b/assets/controllers/modal-form_controller.js
index 172e3b7..10fa04d 100644
--- a/assets/controllers/modal-form_controller.js
+++ b/assets/controllers/modal-form_controller.js
@@ -3,8 +3,12 @@ import { Modal } from 'bootstrap';
export default class extends Controller {
static targets = ['modal'];
+ static values = {
+ formUrl: String,
+ }
openModal(event) {
+ console.log(this.formUrlValue);
const modal = new Modal(this.modalTarget);
modal.show();
}
diff --git a/templates/product_admin/index.html.twig b/templates/product_admin/index.html.twig
index 9e6b821..93d133f 100644
--- a/templates/product_admin/index.html.twig
+++ b/templates/product_admin/index.html.twig
@@ -7,7 +7,9 @@
<div class="d-flex flex-row">
<h1 class="me-3">Product index</h1>
- <div {{ stimulus_controller('modal-form') }}>
+ <div {{ stimulus_controller('modal-form', {
+ formUrl: path('product_admin_new')
+ }) }}>
<button
class="btn btn-primary btn-sm"
data-action="modal-form#openModal"