Support for dinamyc Twig template with comments


Right now I'm in a project that is CMS, in which the path for the template is dynamic.




There is some way to fix it so that it does not show this error, and can use autocomplete, a solution would be to use:

{# @var theme "themes/mytheme/" #}

But this solution is already used for objects which work correctly, it would be ideal to add it for dynamic paths.




Hi there,

Have a look a Symfony plugin -- it adds extra stuff for Twig files and should support this (at very least for the Symfony based projects; but I believe that such setting can be applied to any Twig files/configured separately).


Yes the symfony plugin has to add Path to the general level. And it can be useful for a while.

The problem is that if I'm in the folder /themes/mytheme1/ and I assigned the path theme for /themes/mytheme1/, all right up to here, but if I'm under the folder /themes/mytheme2/ that path no longer works, so the ideal would be at the level of the template twig with comments as the example above, it would be a good idea.


That is not possible.

You need to file Feature Request at either Symfony plugin tracker (as that extra support comes from that plugin) .. or JetBrains one (base Twig support).


Thanks I did it in Symfony Plugin


Please sign in to leave a comment.