void IElementEventHandler.Removing(ElementRemovingContext context) { }
private void RemoveContentItem(ElementRemovingContext context) { var element = (PlaceableContentItem) context.Element; var contentItemId = element.ContentItemId; // Only remove the content item if no other elements are referencing this one. // This can happen if the user cut an element and then pasted it back. // That will delete the initial element and create a copy. var placeableElements = from e in context.Elements.Flatten() let p = e as PlaceableContentItem where p != null && p.ContentItemId == contentItemId select p; if (placeableElements.Any()) return; var contentItem = contentItemId != null ? _contentManager.Value.Get(contentItemId.Value, VersionOptions.Latest) : default(ContentItem); if(contentItem != null) _contentManager.Value.Remove(contentItem); }
public override void Removing(ElementRemovingContext context) { InvokeDrivers(context.Element, driver => driver.Removing(context)); }
public virtual void Removing(ElementRemovingContext context) { }