Skip to content

Instantly share code, notes, and snippets.

@aweber1
Created January 25, 2019 22:27
Show Gist options
  • Save aweber1/e67582dc7c66c5f3561661d09f4fa3ca to your computer and use it in GitHub Desktop.
Save aweber1/e67582dc7c66c5f3561661d09f4fa3ca to your computer and use it in GitHub Desktop.
Sitecore 9.1.0 MVC Experience Editor personalization condition toggle fix
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.customizeRendering>
<processor
type="MyNamespace.DisableCustomization, MyLibrary"
patch:before="Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering.Personalize, Sitecore.Mvc.Analytics" />
</mvc.customizeRendering>
</pipelines>
</sitecore>
</configuration>
using Sitecore.Diagnostics;
using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering;
namespace MyNamespace
{
public class DisableCustomization : CustomizeRenderingProcessor
{
public override void Process(CustomizeRenderingArgs args)
{
Assert.IsNotNull(args, nameof(args));
if (args.IsCustomized)
{
return;
}
// If EE is in editing mode, set `IsCustomized` to true to effectively disable
// the rest of the processors in the `mvc.customizeRendering` pipeline.
if (Sitecore.Context.PageMode.IsExperienceEditorEditing)
{
args.IsCustomized = true;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment