Search code examples
sitecoresitecore-mvcsitecore8.1

Sitecore.Context.PageMode.IsPageEditor VS Sitecore.Context.PageMode.IsExperienceEditor


Inside a rendering, I have some code like this:

 @if (!Model.Item.IsFieldEmpty(ContentBlock.Title) || Sitecore.Context.PageMode.IsPageEditor)
    {
        <h2>
            @Html.Sitecore().RenderField(ContentBlock.Title, Model.Item)
        </h2>
    }

It still works fine for me. But i am getting an warning like 'Sitecore.Context.PageMode.IsPageEditor' is obsolete : use IsExperienceEditor instead. What's the difference between them ??

Note: currently i am using sitecore 8.1.


Solution

  • PageEditor is the named used pre Sitecore 8 - they changed it to Experience Editor. So it is the same thing, but the old name is deprecated and might be removed in newer versions.