How to tell if save was clicked in content editor or page editor in saveUI processor
I have a processor saveUI
and I only want to run my code if the user pressed the save button in the page editor. I tried to check the context like:
Sitecore.Context.PageMode.IsPageEditor
but it is always false. I am assuming the processor is not in the correct context.
How can I check where the click came from? Is the "sender" specified in the arguments somewhere?
source to share
You should be able to correctly define PageMode in Sitecore Context via
if (Sitecore.Context.PageMode.IsPageEditorEditing)
There are also options like
- IsPageEditor
- IsPageEditorDesigning
- IsPageEditorClassic
If you look in the Sitecore.Context.PageMode namespace, you will see all the options available to you so that you can determine the mode you want.
I believe there were different properties for older Sitecore versions (maybe 6.5 and below).
I recommend looking at this post for more information - https://www.sitecore.net/learn/blogs/technical-blogs/martina-welander-sitecore-blog/posts/2013/07/improving-the-page-editor-experience -part-3-detecting-page-mode.aspx
source to share