Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace Helix.Skeleton.Feature.CustomLayoutResolver.Processors
{
using Helix.Skeleton.Feature.CustomLayoutResolver.Constants;
using Sitecore.Mvc.Pipelines.Response.BuildPageDefinition;
using System.Collections.Generic;
using System.Xml.Linq;
public class CustomProcessXmlBasedLayoutDefinition : Sitecore.Mvc.Pipelines.Response.BuildPageDefinition.ProcessXmlBasedLayoutDefinition
{
protected override IEnumerable<Sitecore.Mvc.Presentation.Rendering> GetRenderings(XElement layoutDefinition, BuildPageDefinitionArgs args)
{
foreach (XElement deviceNode in layoutDefinition.Elements("d"))
{
// change the layout ID to the new layout item ID
deviceNode.SetAttributeValue("l", CustomLayoutSettings.LayoutItemId);
}
return base.GetRenderings(layoutDefinition, args);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.