I, unfortunately, don't have an answer for this but this is something I will need to be able to do myself in the not too distant future.....so I figured I would post so others could see the "demand" for this knowledge, haha.
You do this by creating a custom ApplicationEventHandler class.
Here is an example of how to do this:
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
public class MyApplicationEvents : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Saving += ContentService_Saving; // rasied before the content has been saved.
ContentService.Saved += ContentService_Saving; // raised after the content has been saved.
base.ApplicationStarted(umbracoApplication, applicationContext);
}
/// <summary>
/// Event raised when content is saved/saving.
/// </summary>
/// <param name="contentService">Can be used for creating/deleting/editing/move other content etc.</param>
/// <param name="eventArgs">Can be used for showing custom notifications, canceling the save event, and accessing the content beeing saved etc.</param>
private void ContentService_Saving(IContentService contentService, SaveEventArgs<IContent> eventArgs)
{
/* Do custom wizard stuff here.. */
}
}
NOTE: You probobly wont have the same method for both the ContentService.Saving and ContentService.Saved event, cuz that would case the same method to be rasied twice every time you save a piece of content. You probobly have two different methods for each event or you might only be needing the Saving or Saved event.
I just wrote like this in my example so that you would see that its possible to hook in before and after the content saves.
Thank you very much for your reply, but I wanted more to use it in angular if possible, maybe I had to explaine better, but thanks again for youur answer.
Intercepting save event in the backoffice
Hello Community,
What is the right way to intercept save event in the backoffice with AngularJS.
We have to extend save button functionality and add some callback to start saving event and to saved even, is it possible?
Thanks,
Alex
I, unfortunately, don't have an answer for this but this is something I will need to be able to do myself in the not too distant future.....so I figured I would post so others could see the "demand" for this knowledge, haha.
Hi Alex and ThisIsMeJKB.
You do this by creating a custom ApplicationEventHandler class.
Here is an example of how to do this:
Hope this was useful.
Take care!
NOTE: You probobly wont have the same method for both the ContentService.Saving and ContentService.Saved event, cuz that would case the same method to be rasied twice every time you save a piece of content. You probobly have two different methods for each event or you might only be needing the Saving or Saved event.
I just wrote like this in my example so that you would see that its possible to hook in before and after the content saves.
Hi Dennis,
Thank you very much for your reply, but I wanted more to use it in angular if possible, maybe I had to explaine better, but thanks again for youur answer.
Thanks,
Alex
Hi Alex,
Matt Brailsford wrote about this on last years 24 days in Umbraco calendar.
http://24days.in/umbraco/2015/umbraco-7-back-office-tweaks/
Especially the part about tweaking logic is what you are after.
Dave
Ah, im sorry.
Did´nt see any Angular mentions in your original post. :/
Maybe someone else will be happy for the code example.
Have a great weekend Alex!
Your original response is exactly what I was looking for you.
thanks!
Very big thank you to Dennis and Dave, you solved 2 topics!!!
Dave your link is exactly what I need.
Have a great weekend!
Thanks,
Alex
Great! Glad to help!! :)
The ApplicationEventHandler approach no longer works in Umbraco 8. Instead, you'll need to use composition.
The Umbraco documentation provides an example of how to listen to ContentService.Saving events.
is working on a reply...