I am trying to add a new delete event handler when a user removes an image or a library from the Content > Images section. I've already added an event handler to the Global.asax.cs file when Dynamic Content is deleted and it works but I have a question, is the delete images or libraries event handler supported in Sitefinity 12.2?
The IDataEvent system still exists in v12.2, here is the documentation:
[View:https://www.progress.com/documentation/sitefinity-cms/for-developers-idataevent:550:50]
Global.asax
using System;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Data;
using Telerik.Sitefinity.Data.Events;
using Telerik.Sitefinity.Services;
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;
}
private void Bootstrapper_Bootstrapped(object sender, EventArgs e)
{
EventHub.Subscribe<IDataEvent>(evt => DataEventHandler(evt));
}
public void DataEventHandler(IDataEvent eventInfo)
{
var action = eventInfo.Action;
var contentType = eventInfo.ItemType;
var itemId = eventInfo.ItemId;
var providerName = eventInfo.ProviderName;
var manager = ManagerBase.GetMappedManager(contentType, providerName);
var item = manager.GetItemOrDefault(contentType, itemId);
}
}
}Thank you!