I've been mulling around the idea of putting all these template files back in one central location. If every theme function will have a template, scattering them throughout core may become super confusing. Having one place to go to find everything when you need to replace something in core seems to make sense to me. Otherwise, how would a theme dev know where to go to find link.twig?
I think back in earlier versions of drupal all the templates were stuffed in with the actual engine. How do we feel about going back to a model more like that?
Comments
Comment #1
tlattimore commentedI think this is a great idea on many fronts. I still catch my self looking for a default .tpls in the wrong directory even after years of working with them. And a directory structure where twig templates would all be in the same place is even more imperative if there is going to be a template for each theme_ - that's a lot!
What about about placing all templates in something like
/core/themes/engines/twig/templates. Placing them here would create separation from the rest of core and make them clearly distinguished as part the theming layer. And since we do not know the outcome of #1537050: [meta] Should we keep / improve multiple theme engine functionality? there is still the possibility that multiple templating system's will be used with Drupal, so it makes sense to clearly designate templates that are twig related as such.Comment #2
davidneedhamThat makes a lot of sense to me as well. But even if they're all in one place I would still hope for some helper module (ala devel themer) being able to quickly identify and locate a particular twig tpl and suggest candidates for overriding... especially if there are as many as you expect there to be.
Comment #3
jenlamptonI talked to Alex about this, and I think we're going to put all the templates in 'templates' folders for their respective modules, for example:
core/modules/comment/templates/comment.twigBut, there will be a lot of general templates that do not relate to any specific module, and those should all live in system. (This includes all the new templates for theme functions in theme.inc and common.inc)
core/modules/system/templates/comment.twigMarking as postponed until this core issue gets resolved:
#1760530: Move all template files provided by core modules and themes into a 'templates' directory
Also, moving to active twig sandbox.
Comment #4
star-szrCore issue has been resolved, marking this as fixed.