I created my own small form type Symfony2. For this to work correctly, I need to enable the js library. Although it was a simple task when using this new form type in one web application, it became much more difficult when I decided to move this form type to a dedicated package to make it reusable.
I currently know about two possible solutions.
1) Ask everyone who uses my package to add a line to their base.html.twig
2) Add a tag <script>to insert the library into the form widget
Both of them are not very smart, so my question is: how can I do this better? Especially if my type of form can be included several times on the same page. And even worse, if I need a type of form, for example. JQuery is present, but I do not know if jQuery is already loaded in the application.
source
share