DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) { return(Process(context.ContentItem, (part, field) => { DriverResult result = Editor(part, field, context.Updater, context.New); if (result != null) { result.ContentPart = part; result.ContentField = field; } return result; }, context.Logger)); }
DriverResult IContentFieldDriver.BuildDisplayShape(BuildDisplayContext context) { return(Process(context.ContentItem, (part, field) => { DriverResult result = Display(part, field, context.DisplayType, context.New); if (result != null) { result.ContentPart = part; result.ContentField = field; } return result; }, context.Logger)); }
DriverResult IContentPartDriver.BuildEditor(BuildEditorContext context) { var part = context.ContentItem.As <TContent>(); if (part == null) { return(null); } DriverResult result = Editor(part, context.New); if (result != null) { result.ContentPart = part; } return(result); }
DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) { var part = context.ContentItem.As <TContent>(); if (part == null) { return(null); } DriverResult result = Display(part, context.DisplayType, context.New); if (result != null) { result.ContentPart = part; } return(result); }
DriverResult IContentPartDriver.UpdateEditor(UpdateEditorContext context) { var part = context.ContentItem.As <TContent>(); if (part == null) { return(null); } // checking if the editor needs to be updated (e.g. if it was not hidden) var editor = Editor(part, context.New) as ContentShapeResult; if (editor != null) { ShapeDescriptor descriptor; if (context.ShapeTable.Descriptors.TryGetValue(editor.GetShapeType(), out descriptor)) { var placementContext = new ShapePlacementContext { Content = part.ContentItem, ContentType = part.ContentItem.ContentType, Differentiator = editor.GetDifferentiator(), DisplayType = null, Path = String.Empty }; var location = descriptor.Placement(placementContext).Location; if (String.IsNullOrEmpty(location) || location == "-") { return(editor); } } } DriverResult result = Editor(part, context.Updater, context.New); if (result != null) { result.ContentPart = part; } return(result); }