contao/core — pull request #4547 by Toflar (2012-07-20 14:08:55+00:00)
Title: first draft of making module templates customizable

This is my idea of how we could try to make every module's template configurable by the users.
This would give us ***so much more*** flexibility, I can't even emphasize this enough!

In this PR I tried to use the ```$strTemplate``` variable of every module and it works perfectly fine. Every module gets a new ```modtpl``` field in ```tl_module```.
Obviously this is not really backward compatible as - to make it a proper implementation - we would need to rename some of the templates, I guess.
E.g. the search module has different templates you can choose from in the "template settings". They'd become completely obsolete as this is in fact exactly the module template overriding possibility we want to have in every module.

Also I don't know whether taking ```$strTemplate``` from every module's class is a good idea. Probably it would be better to make this configurable with a global array. Or even better:
Make a ```Module::getTemplateChoices``` that returns ```$strTemplate``` by default and can be overwritten in every module. If it returns ```null``` then the field doesn't need to be displayed in the module options. But this option came to my mind while writing this comment so I'm not gonna change it again as it's a PoC anyway :)

Again, it's a foundation so other developers and maybe also @leofeyer have a common ground to start from for discussions and improvements.

Feel free to fork my branch and send me pull requests so this one gets automatically updated :-)