New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Twig] Accept an array of template in the render method #29808

lyrixx opened this Issue Jan 7, 2019 · 2 comments


None yet
2 participants
Copy link

lyrixx commented Jan 7, 2019

Twig is able to select a template from an array of templates
(see or )

I could be nice to expose this feature in the abstract controller. What do you think ?


$this->render(['cms/layout/$layout.html.twig', 'cms/layout/default.html.twig'])

This comment has been minimized.

Copy link

mickaelandrieu commented Jan 7, 2019


it depends if you (ie the Symfony team) want to promote this practice or not... regarding what we do in the Grid component of PrestaShop (that initially relies on this nice feature), the impact on performances can be really big, so we manage to provide this a different way =>

Also, outside of this scope, I've never met a use case for that when we already have so many ways to make templates dynamic, so I'm interested in your owns.



This comment has been minimized.

Copy link

lyrixx commented Jan 8, 2019

Actually, The response should be different according to the value of $layout (CSP-Headers).
So I finally added a real if ($template) in my controller.
I don't need this feature anymore.
I'm closing this issue as I think this is not a really common need

@lyrixx lyrixx closed this Jan 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment