zotonic/zotonic — Issue #265: module template api
Author: kaos
Created: 2011-11-23 07:17:45+00:00
State: open

There are a number of templates floating around that are being referenced across module boundaries.
I'd like to call these templates *api templates*, since they're meant to be included from other modules templates.

These api templates gives a dependency between modules that isn't really clear.
Arjan made a commit to solve one of [those] (https://github.com/zotonic/zotonic/commit/13cfb05d8fef9aab966e7c41de39b5739b8f9cf8) (by adding an empty _language_attrs.tpl in the admin module.. but there a more, and this approach doesn't feel quite right).

So, I suggest that we add another level of indirection in the templates directory, so we have private and public templates, and that only templates that are made public may be included from other modules.

This serves another purpose too, by making it clear which templates exist that are suitable for other modules to include. For instance the admin module has a number of such templates, but they're quite hard to find unless you know about them.

And last, what to do when trying to include a missing template. There are a number of scenarios:

1. The template doesn't exist
2. The template is found from a disabled module
3. The template is private

A new flag could be added to the include tag, specifying if a missing/private template should silently be ignored, generate a warning or fail with an error message.