Skip to content

Instantly share code, notes, and snippets.

@Phoen1x84
Last active November 28, 2016 23:16
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 Phoen1x84/93ecaf27b5ec48354e484ee983bdc9a9 to your computer and use it in GitHub Desktop.
Save Phoen1x84/93ecaf27b5ec48354e484ee983bdc9a9 to your computer and use it in GitHub Desktop.
Sitecore Detect Page Editor C#
if (Sitecore.Context.PageMode.IsPageEditor)
{
// capture all page modes
}
// detailed page modes which could be handy for different editor types
if (Sitecore.Context.PageMode.IsPageEditorEditing)
{
// specific if using the experience editor
// handy for content editors who only edit content and don't make structural changes to the page
}
if (Sitecore.Context.PageMode.IsPreview)
{
// specific if using the preview mode
}
if (Sitecore.Context.PageMode.IsPageEditorDesigning)
{
// specific if using the design mode
// this can be really handy for non-content editors and someone who constructs the page
// and need to see all the functionality
}
if (Sitecore.Content.PageMode.IsPageEditorNavigating)
{
// general clicking around the site in page editor mode
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment