KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to use javascript in custom Symfony 2 form field type extension. So, I have Twig extension template like this: {% block some_widget %} <input ... /> <script src="some.js"></script> <link href="some.css" /> {% endblock %} But I want to have these script and link tags only once in my HTML, ideally in head tag, without modifing base template. I tried to extend Twig blocks, but I have no access to action template blocks inside form template. Or maybe something like this: {# widget tempate #} {% block some_widget %} <input ... /> {{ use_javascript('some.js') }} {{ use_css('some.css') }} {% endblock %} {# main action template #} ... <head> {{ dump_javascripts() }} {{ dump_css() }} </head> ... How to do this with Symfony 2 Forms + Twig? P.S. Sorry for my bad english.
Tags (comma-separated)
Save Edits
Cancel