Ranting about new multiple template inheritance capabilities and its virtues made me think what’s missing: you still cannot extend the template without manually modifying the template itself.
Specific scenario bugging me is extending Sitecore templates, like ‘standard template’, fields, etc. Long story short, I’ve hacked together a quick prototype to share the idea.
The solution adds ‘/sitecore/system/template extenders’ folder, a place to add template extender items. Each extender can extend a list defined templates with another list of mix-in templates. ‘Extending’ a template basically means making sure that it has mixed-in template as one of the base templates.
Extending 'Standard Template' with two additional templates. So from the technical point of view the prototype hooks into the initialize pipeline, and registers all extenders found in /sitecore/system/template extenders each time Sitecore starts up. Initialize pipeline was just the quickest way to hook somewhere, good enough for prototype.
Unlike modifying base templates manually, extending templates in this manner can be done automatically via the package install. It is also more future proof: if the standard template gets modified later, extenders make sure to add base template again, so you can rely on the additional fields being there.
The package requires old packager (developer tools -> packager) to install, and in beta 060705 it looks like you have to fix ‘package folder’ setting in web.config.
Package also installs a sample: two dummy templates (‘A’ and ‘B’) and an extender to add them to standard template. If everything’s alright, you will see two more fields on all items. If not – oh well, this should have been clean throw-away instance.
Package: templateextender_prototype_oldpackager.zip (21.08 KB)Sources: TemplateExtender_prototype_src.zip (11.81 KB)