Thursday 5 December 2019

Umbraco: Disable Save and Publish button in admin side


  • Disable Save and Publish button in admin side

    Do we have any option to disable the save and publish button available in umrbaco programmatically.?
  • Daniel Bardi 915 posts 2542 karma points
    Dec 14, 2011 @ 04:58
    Daniel Bardi
    0
    You can cancel the save and publish actions by attaching to the BeforeSave and BeforePublish events.
      public class SavePublishHandler : ApplicationBase
        {
            public SavePublishHandler()        {
                Document.BeforeSave += Document_BeforeSave;            Document.BeforeSendToPublish += Document_BeforeSendToPublish;        }
    
            private void Document_BeforeSendToPublish(Document sender, umbraco.cms.businesslogic.SendToPublishEventArgs e)        {
                e.Cancel = true;
            }
    
            private void Document_BeforeSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e)        {
                e.Cancel = true;
            }
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive