In Experience Editor we get the below alert bar where we can change the state and other workflow related changes, is there a way to disable it for some pages:
-
Do you want any specific alert to hide or you want it for all types of alerts?– Mahendra ShekhawatJul 28, 2020 at 13:18
-
I want it if it is for Workflow only if that is possible, I am not able find the root how it works. It seems to be dynamic binding to js– DebaparnaJul 29, 2020 at 4:42
-
If it can be disable for few Roles that also will do, Please suggest any possible solution for the same.– DebaparnaJul 29, 2020 at 13:23
1 Answer
Sitecore's getPageEditorNotifications
pipeline is responsible to show the alert in Experience Editor. I will not recommend hiding the notification in Experience Editor but if it is your requirement then you need to add your condition by creating a processor
class which will inherit the GetPageEditorNotificationsProcessor
or as per your requirement you can override the process method of GetWorkflowNotification
processor for showing the workflow notification only if the current user is not in a specific role.
namespace YourNameSpace
{
public class RoleBasedWorkflowNotification : GetWorkflowNotification
{
public override void Process(GetPageEditorNotificationsArgs arguments)
{
//Your condition to check the user
if (!Sitecore.Context.User.IsInRole("sitecore\\customrole"))
{
base.Process(arguments);
}
}
}
}
and after that, you need to patch your code as below -
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentManagement or ContentDelivery or Reporting or Processing">
<pipelines>
<group groupName="ExperienceEditor" name="ExperienceEditor">
<pipelines>
<getPageEditorNotifications>
<processor
type="YourNameSpace.RoleBasedWorkflowNotification, YourNameSpace"
patch:instead="processor[@type='Sitecore.Pipelines.GetPageEditorNotifications.GetWorkflowNotification, Sitecore.ExperienceEditor']" />
</getPageEditorNotifications>
</pipelines>
</group>
</pipelines>
</sitecore>
</configuration>