I have a child template which extends ::base.html.twig. The base template includes a javascripts block. I can override the included javascripts inside my child template.
But then if I do an twig include to a third template which just contains a form, I cannot inject additional javascript from the third template inside the child template inside the javascripts block (or a nested block)
There is further detail here - https://gist.github.com/3182772
Is this possible?
This github issue seems to suggest that it isn't but traits are no good to me as I am extending a base template.
https://github.com/fabpot/Twig/issues/644
You don't need the inner block. Just keep doing this:
{% block javascripts %}
{{ parent() }}
{# put additional JS here #}
{% endblock %}
You can keep doing this for as much levels as you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With