@@ -337,32 +337,32 @@ For example:
337
337
338
338
.. code-block :: html+twig
339
339
340
- <div {{ stimulus_target('controller', 'a-target ') }}>Hello</div>
341
- <div {{ stimulus_target('controller', 'a-target second-target ') }}>Hello</div>
340
+ <div {{ stimulus_target('controller', 'myTarget ') }}>Hello</div>
341
+ <div {{ stimulus_target('controller', 'myTarget secondTarget ') }}>Hello</div>
342
342
343
343
<!-- would render -->
344
- <div data-controller-target="a-target ">Hello</div>
345
- <div data-controller-target="a-target second-target ">Hello</div>
344
+ <div data-controller-target="myTarget ">Hello</div>
345
+ <div data-controller-target="myTarget secondTarget ">Hello</div>
346
346
347
347
If you have multiple targets on the same element, you can chain them as there's
348
348
also a ``stimulus_target `` filter:
349
349
350
350
.. code-block :: html+twig
351
351
352
- <div {{ stimulus_target('controller', 'a-target ')|stimulus_target('other-controller', 'another-target ') }}>
352
+ <div {{ stimulus_target('controller', 'myTarget ')|stimulus_target('other-controller', 'anotherTarget ') }}>
353
353
Hello
354
354
</div>
355
355
356
356
<!-- would render -->
357
- <div data-controller-target="a-target " data-other-controller-target="another-target ">
357
+ <div data-controller-target="myTarget " data-other-controller-target="anotherTarget ">
358
358
Hello
359
359
</div>
360
360
361
361
You can also retrieve the generated attributes as an array, which can be helpful e.g. for forms:
362
362
363
363
.. code-block :: twig
364
364
365
- {{ form_row(form.password, { attr: stimulus_target('hello-controller', 'a-target ').toArray() }) }}
365
+ {{ form_row(form.password, { attr: stimulus_target('hello-controller', 'myTarget ').toArray() }) }}
366
366
367
367
.. _configuration :
368
368
0 commit comments