File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -604,20 +604,30 @@ to the ``peerDependencies``:
604
604
605
605
In this case, the file located at ``[assets directory]/dist/controller.js `` will be exposed.
606
606
607
- If the bundle is named ``acme/feature ``, the base key for the controller will be ``acme--feature--slug ``: it's composed
608
- of the bundle name and the controller name defined in the ``package.json `` file.
609
-
610
607
To use it in a template (e.g. one defined in your bundle) you can use it like this:
611
608
612
609
.. code-block :: html+twig
613
610
614
611
<div
615
- data-controller="acme--feature--slug"
616
- data-acme--feature--slug-modal-value="my-value"
612
+ {{ stimulus_controller('acme/feature/slug', { modal: 'my-value' }) }}
613
+ {#
614
+ will render:
615
+ data-controller="acme--feature--slug"
616
+ data-acme--feature--slug-modal-value="my-value"
617
+ #}
617
618
>
618
619
...
619
620
</div>
620
621
622
+ Don't forget to add ``symfony/webpack-encore-bundle:^1.12 `` as a composer dependency to use
623
+ Twig ``stimulus_* `` functions.
624
+
625
+ .. tip ::
626
+
627
+ If the bundle is named ``acme/feature `` and the controller is named ``slug ``, the base key for the controller
628
+ will be ``acme/feature/slug ``: it's composed of the bundle name and the controller name defined in
629
+ the ``package.json `` file.
630
+
621
631
Learn more
622
632
----------
623
633
You can’t perform that action at this time.
0 commit comments