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 any of the shapes were not hidden). DriverResult editor = Editor(part, context.New); IEnumerable <ContentShapeResult> contentShapeResults = editor.GetShapeResults(); if (contentShapeResults.Any(contentShapeResult => contentShapeResult == null || contentShapeResult.WasDisplayed(context))) { DriverResult result = Editor(part, context.Updater, context.New); if (result != null) { result.ContentPart = part; } return(result); } return(editor); }
DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) { return(Process(context.ContentItem, (part, field) => { // Checking if the editor needs to be updated (e.g. if any of the shapes were not hidden). DriverResult editor = Editor(part, field, context.New); IEnumerable <ContentShapeResult> contentShapeResults = editor.GetShapeResults(); if (contentShapeResults.Any(contentShapeResult => contentShapeResult == null || contentShapeResult.WasDisplayed(context))) { DriverResult result = Editor(part, field, context.Updater, context.New); if (result != null) { result.ContentPart = part; result.ContentField = field; } return result; } return editor; }, context.Logger)); }