Skip to content

Instantly share code, notes, and snippets.

@trnktms
Last active February 23, 2019 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/0d780a1a9686e191c5d76379e127f390 to your computer and use it in GitHub Desktop.
Save trnktms/0d780a1a9686e191c5d76379e127f390 to your computer and use it in GitHub Desktop.
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