Plugins
Plugins are a way of adding a different behavior when decoration elements, examples of plugins are:
- Custom rendered elements (The date/calendar element you just spoken on issue #4)
- Using a specific decorator
- Escape HTML data
How designer could use them:
<div id="post-comments" class="respect-escape-html"></div>
Or we could use data attribute, but classes just seem a little bit better and we can use them as selectors also. Waiting your considerations ...
Custom rendered elements are bad, since the designer would never see them before the developer did his part. Not sure how we solve this problem, but the designer should never rely on PHP to see how the template really are, this is the most critical flaw of every template engine out there.
Escaping and filtering seems good, we need to come up with real use cases.
Another real use cases:
- EmptyDecorator - Used when no data is passed by the backend (There is no data to show in this table) or when the designer does not want the element to show when there is no data passed by the backend
- TemplateDecorator - Used when some pre-defined element(s) by the designer are used by the Template (Ex: Zebra rows)
An idea is that a plugin is always an adapter or/and a decorator. Another ideas to plugins ...
- l10n / i18n plugin
- Asset manipulation (images as sprites, concat css and javascript)
- Google Analytics plugin