I have been tasked with finding out which of our Sublayouts have caching turned on. I'm not talking about the caching on the sublayout - I mean the caching on each individual instance of that sublayout as set in the rendering parameters.
Here's what I currently do:
- Parse the entire tree of our site looking at each item
- Get the renderings on each item
- Cycle through each rendering
- Check if 'Cachable' has been set in the 'Caching' section
My problem is that the 'Cachable' setting I'm seeing is the one set in the Sublayout (under Layout > Sublayouts in Sitecore) and not the one I set on the instance of that sublayout on my item (My Item > Presentation > Details > click control)
My code is written on a stand alone
Number 1 is no problem - here's what I do for each item:
2)
RenderingReference[] renderings = item.Visualization.GetRenderings(Sitecore.Context.Device, true);
3)
foreach (RenderingReference r in renderings)
4)
bool cacheable = r.RenderingItem.Caching.Cacheable;
It seems I'm missing a step where I get the rendering parameters specific to each sublayout. However, from the guides I have read it seems you need the sublayout itself to get access to these parameters. I cannot find a way to get a sublayout from an item or rendering reference (maybe with good reason?). Can anyone help me progress?