I'm designing a multi-tenant application for Symfony2, where each tenant can have a theme that overrides the default application templates. So a theme will have a unique base.html.twig
file, and may or may not include other files that override the default template files.
Symfony2 already checks app/Resources/views
for templates that override the bundle templates. But Symfony2 assumes app/Resources/views
has just one set of templates that can override the default templates. I want to dynamically check a tenant's custom theme folder for various overriding templates, e.g.:
- Theme:
app/Resources/views/theme1/base.html.twig
- Theme:
app/Resources/views/theme2/base.html.twig
app/Resources/views/theme2/SomeBundle/Resources/views/page.html.twig
I'm not sure the best way to structure this in Symfony2 and to configure it in Twig. Should I pile all of the different themes into folders in app/Resources/views? Or should I create some kind of ThemeBundle that handles everything? Thanks!