Created
January 25, 2019 22:27
-
-
Save aweber1/e67582dc7c66c5f3561661d09f4fa3ca to your computer and use it in GitHub Desktop.
Sitecore 9.1.0 MVC Experience Editor personalization condition toggle fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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