February 23, 2015

Cascading Renderings in Sitecore 8

By: Craig Taylor
February 23, 2015

Cascading Renderings in Sitecore 8

I have a client that has a need to have managed content within their navigational menu.  We were able to dynamically insert placeholders and control the datasources for the renderings inserted.  When we went to another page in the site, we realized that the renderings we inserted were only associated with the original page instead of the entire site as we intended.  We needed to cascade the renderings down to all the subpages.

It's been done before

There are already some great starting points out there from Alex Shyba and Pavel Veller.  Alex originally wrote about it and Pavel updated the code to work with MVC.  Thanks guys!

One small change

With Sitecore 8 comes the idea of Versioned Layouts.  Since we can now have a shared and final layout, the code should be updated to check the "FinalLayoutField" so that we have access to any renderings added using the Experience Editor.

Field layoutField = parent.Fields[FieldIDs.LayoutField];
needs to be changed to:

Field layoutField = parent.Fields[FieldIDs.FinalLayoutField];