mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added CreatingDisplay event to ElementDriver.
This commit is contained in:
@@ -27,6 +27,9 @@ namespace Orchard.Layouts.Framework.Display {
|
||||
string displayType = null,
|
||||
IUpdateModel updater = null) {
|
||||
|
||||
var typeName = element.GetType().Name;
|
||||
var category = element.Category.ToSafeName();
|
||||
var drivers = element.Descriptor.GetDrivers().ToList();
|
||||
var createShapeContext = new ElementCreatingDisplayShapeContext {
|
||||
Element = element,
|
||||
DisplayType = displayType,
|
||||
@@ -34,14 +37,13 @@ namespace Orchard.Layouts.Framework.Display {
|
||||
};
|
||||
|
||||
_elementEventHandlerHandler.CreatingDisplay(createShapeContext);
|
||||
element.Descriptor.CreatingDisplay(createShapeContext);
|
||||
InvokeDrivers(drivers, driver => driver.CreatingDisplay(createShapeContext));
|
||||
if (element.Descriptor.CreatingDisplay != null)
|
||||
element.Descriptor.CreatingDisplay(createShapeContext);
|
||||
|
||||
if (createShapeContext.Cancel)
|
||||
return null;
|
||||
|
||||
var typeName = element.GetType().Name;
|
||||
var category = element.Category.ToSafeName();
|
||||
var drivers = element.Descriptor.GetDrivers().ToList();
|
||||
var elementShapeArguments = CreateArguments(element, content);
|
||||
var elementShape = (dynamic)_shapeFactory.Create("Element", elementShapeArguments, () => new ZoneHolding(() => _shapeFactory.Create("ElementZone")));
|
||||
|
||||
|
@@ -17,6 +17,10 @@ namespace Orchard.Layouts.Framework.Drivers {
|
||||
return OnUpdateEditor((TElement)context.Element, context);
|
||||
}
|
||||
|
||||
public void CreatingDisplay(ElementCreatingDisplayShapeContext context) {
|
||||
OnCreatingDisplay((TElement)context.Element, context);
|
||||
}
|
||||
|
||||
public void Displaying(ElementDisplayingContext context) {
|
||||
OnDisplaying((TElement) context.Element, context);
|
||||
}
|
||||
@@ -49,6 +53,9 @@ namespace Orchard.Layouts.Framework.Drivers {
|
||||
return OnBuildEditor(element, context);
|
||||
}
|
||||
|
||||
protected virtual void OnCreatingDisplay(TElement element, ElementCreatingDisplayShapeContext context) {
|
||||
}
|
||||
|
||||
protected virtual void OnDisplaying(TElement element, ElementDisplayingContext context) {
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ namespace Orchard.Layouts.Framework.Drivers {
|
||||
int Priority { get; }
|
||||
EditorResult BuildEditor(ElementEditorContext context);
|
||||
EditorResult UpdateEditor(ElementEditorContext context);
|
||||
void CreatingDisplay(ElementCreatingDisplayShapeContext context);
|
||||
void Displaying(ElementDisplayingContext context);
|
||||
void Displayed(ElementDisplayedContext context);
|
||||
void LayoutSaving(ElementSavingContext context);
|
||||
|
Reference in New Issue
Block a user