我将发布事件链接为:
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { ContentService.Published += ContentService_Published; } private void ContentService_Published(global::Umbraco.Core.Publishing.IPublishingStrategy sender, PublishEventArgs<IContent> e) { // My code , Send Error }
当用户“保存并发布”内容时,我想用自定义错误消息显示umbraco默认错误弹出窗口。
提前谢谢。
在你的 ContentService_Published 方法我相信你可以这样做:
ContentService_Published
e.Cancel = true; e.Messages.Add(new EventMessage("Ouch!", "Better try that again but more gently this time!!!", EventMessageType.Error));