Allow Inherited Templates as Rendering Datasource

What problem does this solve?

  1. RenderingA datasource template is EnhancedContentTemplate
  2. RenderingB datasource template is ContentTemplate
  3. EnhancedContentTemplate inherits from ContentTemplate
  4. Add RenderingA to a page, create datasource EnhancedContentTemplate
  5. Add RenderingB to another page, try to reference same datasource as RenderingA - this would not be allowed out-of-the-box with Sitecore.

How do I use it?

There is no special action needed. Inherited templates are automatically allowed to be selected when choosing a rendering datasource.

How does it work?

The getRenderingDatasource pipeline has been extended to include a processor called AddDerivedTemplatesForSelection. This pipeline processor adds all derived templates to the allowed “TemplatesForSelection” list.

Credit

This feature started as an original idea by Patrick Delancy, but this article by Gert Gullentops helped inform the final implementation, even though we didn’t solve the problem in the same way.