protected override void UpdateEditorShape(UpdateEditorContext context, ContentPart part)
        {
            if (!string.Equals(_groupId, context.GroupId, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var templatePart = part.As <TPart>();

            context.Updater.TryUpdateModel(templatePart, _prefix, null, null);
            BuildEditorShape(context, part);
        }
 public override void UpdateEditor(UpdateEditorContext context)
 {
     _drivers.Invoke(driver => {
         var result = driver.UpdateEditor(context);
         if (result != null)
             result.Apply(context);
     }, Logger);
 }
        public dynamic UpdateEditor(IContent content, IUpdateModel updater, string groupInfoId)
        {
            var contentTypeDefinition = content.ContentItem.TypeDefinition;
            string stereotype;
            if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
                stereotype = "Content";

            var actualShapeType = stereotype + "_Edit";

            dynamic itemShape = CreateItemShape(actualShapeType);
            itemShape.ContentItem = content.ContentItem;

            var workContext = _workContextAccessor.GetContext(_requestContext.HttpContext);

            var theme = workContext.CurrentTheme;
            var shapeTable = _shapeTableLocator.Value.Lookup(theme.Id);

            // adding an alternate for [Stereotype]_Edit__[ContentType] e.g. Content-Menu.Edit
            ((IShape)itemShape).Metadata.Alternates.Add(actualShapeType + "__" + content.ContentItem.ContentType);

            var context = new UpdateEditorContext(itemShape, content, updater, groupInfoId, _shapeFactory, shapeTable);
            BindPlacement(context, null, stereotype);

            _handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);

            return context.Shape;
        }
Ejemplo n.º 4
0
 protected virtual void UpdateEditorShape(UpdateEditorContext context)
 {
 }
 protected override void UpdateEditorShape(UpdateEditorContext context, TContent instance)
 {
 }