• Not Answered

Multiple inheritance and presentation details

Hello all.

Having read the helix principle documentation at http://helix.sitecore.net, and in particular the topic about template inheritance (http://helix.sitecore.net/principles/templates/inheritance.html) , I've noticed the figure in that page, which essentially tells me that I should be able to:

 

1. Define a data template (call it TemplateA) in module Feature/moduleA,

2. Define a rendering (call it RenderingA) in module Feature/moduleA

3. Assign RenderingA to TemplateA's presentation details without a layout

4. Do the same for TemplateB, renderingB in module Feature/moduleB.

5. Define a page type template PageA in my project layer module, and have it inherit from TemplateA and TemplateB.

6. Assign layout LayoutL to its presentation details. 

Any items of template PageA should have LayoutL, RenderingA and RenderingB in their presentation details by default.

The above, of course would suffer from rigidity in the face of change: if you want to make a change in the parameters of  RenderingA, and have it apply to all items of a template inheriting TemplateA (let's say it's PageA and PageB that inherit from TemplateA) then you'd have to go to the presentation details of PageA and PageB, reset them, then re-apply any changes you've made on top of the original (in this case just the layout, but in real world scenarios it could be many renderings with datasources and parameters). That's because in setting the layout to LayoutL, you've overriden the inherited presentation details and so changes in the parent templates are no longer propagated.

So I thought of adding an additional "layer" to mitigate the above: I added a Template (call it TemplateF) in my project layer module. that only has the layout LayoutL defined in its presentation details. Then in Template PageA I inherit all three: TemplateA, TemplateB and TemplateF. I should be getting the intended result (LayoutL, RenderingA and RenderingB in the presentation details of PageA).

 

but...

 

I don't.

 

What I get in PageA, is the presentation details of only the first base template in the list as it appears in the "Base Templates" field of PageA. If the first one in the list is TemplateF, then PageA only has the layout LayoutL in its presentation details. If I push TemplateA or TemplateB, I get RenderingA or RenderingB respectively, but without a layout.

My current project is based on Habitat, and it builds against Sitecore 8.2 update1. I know it's not really Habitat specific, because I've consistently reproduced the issue even on a clean Sitecore install. I can't be sure whether it's version specific, as I haven't been able (for various reasons) to set up many different versions of Sitecore.

 

Has anyone else faced the same issue? Any solutions in sight? I really like the idea of pushing presentation details through base templates as described in Helix, but from the looks of it, the implementation in sitecore it's either buggy or not well thought of.

 

Regards,

Yiannis

2 Replies