This is just a short post dedicated to the fact that every now and then I’m reminded of why I enjoy working with Sitecore as much as I do.
Consider a scenario where you have some component that in some way needs to use an item as a datasource. Let’s say it’s a spot/banner component showing a link to a news item by displaying the news item’s publication date, title, image and description. Very typical. Now you want to restrict the datasource template which of course is easily accomplished by using the Datasource Template field on the Sitecore item that defines the spot component. This is an Internal Link field that resides on the Rendering Options template which in turn is inherited by all the different rendering templates in Sitecore. An internal link field can only link to one item, which means that you cannot select more than one template as a valid datasource for the component.
In this scenario you might like to be able to use different kinds of templates for different kinds of news items, like press releases, articles, events and what not. Can this be done? You bet. If the different news item templates share a common base template you can select that base template in the Datasource Template field on your component and Sitecore automatically allows every template including that base template as a valid datasource for the component.
***imagine a funny meme here about awesomeness***
This wouldn’t have been that hard to implement yourself by overriding the validation code for the Datasource Template field, but it’s even easier to just find that Sitecore already supports using a base template as a datasource template.
Takeaway: Using template inheritance in Sitecore is very handy indeed!