Esempio n. 1
0
 public Task UpdateEditorAsync(ContentItem model, UpdateEditorContext context)
 {
     return(Process(model, async(partFieldDefinition, part, fieldName) =>
                    await _displayDrivers.InvokeAsync(async contentDisplay => {
         var result = await contentDisplay.UpdateEditorAsync(fieldName, part, partFieldDefinition, context);
         if (result != null)
         {
             result.Apply(context);
         }
     }, Logger)
                    ));
 }
Esempio n. 2
0
        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           = context.Path
                    };

                    var location = descriptor.Placement(placementContext).Location;

                    if (String.IsNullOrEmpty(location) || location == "-")
                    {
                        return(editor);
                    }

                    var editorGroup  = editor.GetGroup() ?? "";
                    var contextGroup = context.GroupId ?? "";

                    if (!String.Equals(editorGroup, contextGroup, StringComparison.OrdinalIgnoreCase))
                    {
                        return(editor);
                    }
                }
            }

            DriverResult result = Editor(part, context.Updater, context.New);

            if (result != null)
            {
                result.ContentPart = part;
            }

            return(result);
        }
Esempio n. 3
0
        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;
            }));
        }
Esempio n. 4
0
        public override async Task <IDisplayResult> UpdateAsync(ContentItem model, UpdateEditorContext context)
        {
            var layerMetadata = new LayerMetadata();

            if (!await context.Updater.TryUpdateModelAsync(layerMetadata, "LayerMetadata", m => m.Zone, m => m.Position, m => m.RenderTitle, m => m.Title, m => m.Layer) ||
                String.IsNullOrEmpty(layerMetadata.Zone))
            {
                return(null);
            }

            model.Apply(layerMetadata);

            return(await EditAsync(model, context));
        }
Esempio n. 5
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            if (context.GroupId == GroupId)
            {
                var model = new SiteSettingsViewModel();

                if (await context.Updater.TryUpdateModelAsync(model, Prefix, t => t.SiteName, t => t.TimeZone))
                {
                    site.SiteName = model.SiteName;
                    site.TimeZone = model.TimeZone;
                }
            }

            return(Edit(site));
        }
Esempio n. 6
0
        public override async Task UpdateEditorAsync(UpdateEditorContext context, IModelUpdater updater)
        {
            var testContentPart = context.Content.As <TestContentPartA>();

            if (testContentPart == null)
            {
                return;
            }

            if (await updater.TryUpdateModelAsync(testContentPart, ""))
            {
                context.Content.ContentItem.Weld(testContentPart);
            }

            return;
        }
Esempio n. 7
0
        protected override void UpdateEditorShape(UpdateEditorContext context)
        {
            var part = context.ContentItem.As <TermPart>();

            if (part == null)
            {
                return;
            }
            base.UpdateEditorShape(context);
            var existing = _taxonomyService.GetTermByName(part.TaxonomyId, part.Name);

            if (existing != null && existing.Record != part.Record && existing.Container.ContentItem.Record == part.Container.ContentItem.Record)
            {
                context.Updater.AddModelError("Name", T("The term {0} already exists at this level", part.Name));
            }
        }
Esempio n. 8
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            if (context.GroupId == GroupId)
            {
                var model = new ElsaWorkflowsSettingsViewModel();

                if (await context.Updater.TryUpdateModelAsync(model, Prefix))
                {
                    var settings = site.As <ElsaSettings>();
                    settings.WorkflowServerUrl = model.WorkflowServerUrl?.Trim();
                    site.Put(settings);
                }
            }

            return(Edit(site));
        }
        public async Task <IShape> UpdateEditorAsync(ContentItem contentItem, IUpdateModel updater, bool isNew, string groupId, string htmlFieldPrefix)
        {
            if (contentItem == null)
            {
                throw new ArgumentNullException(nameof(contentItem));
            }

            var contentTypeDefinition = _contentDefinitionManager.LoadTypeDefinition(contentItem.ContentType);

            if (contentTypeDefinition == null)
            {
                throw new NullReferenceException($"Content Type {contentItem.ContentType} does not exist.");
            }

            var stereotype      = contentTypeDefinition.GetSettings <ContentTypeSettings>().Stereotype;
            var actualShapeType = (stereotype ?? "Content") + "_Edit";

            var itemShape = await CreateContentShapeAsync(actualShapeType);

            itemShape.Properties["ContentItem"] = contentItem;
            itemShape.Properties["Stereotype"]  = stereotype;

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

            var context = new UpdateEditorContext(
                itemShape,
                groupId,
                isNew,
                htmlFieldPrefix,
                _shapeFactory,
                await _layoutAccessor.GetLayoutAsync(),
                new ModelStateWrapperUpdater(updater)
                );

            await BindPlacementAsync(context);

            var updateContentContext = new UpdateContentContext(contentItem);

            await _contentHandlers.InvokeAsync((handler, updateContentContext) => handler.UpdatingAsync(updateContentContext), updateContentContext, _logger);

            await _handlers.InvokeAsync((handler, contentItem, context) => handler.UpdateEditorAsync(contentItem, context), contentItem, context, _logger);

            await _contentHandlers.Reverse().InvokeAsync((handler, updateContentContext) => handler.UpdatedAsync(updateContentContext), updateContentContext, _logger);

            return(context.Shape);
        }
Esempio n. 10
0
        public dynamic UpdateEditor(IContent content, string metadataType, string modelType, string partTypeName, string fieldTypeName, IUpdateModel updateModel)
        {
            dynamic itemShape = CreateItemShape(metadataType);

            itemShape.ContentItem = content.ContentItem;

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

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

            var context = new UpdateEditorContext(itemShape, content, updateModel, string.Empty, _shapeFactory, shapeTable);

            if (string.Equals(modelType, "Part", StringComparison.OrdinalIgnoreCase))
            {
                var drivers = FindPartDrivers(partTypeName);

                foreach (var driver in drivers)
                {
                    var result = driver.UpdateEditor(context);

                    if (result != null)
                    {
                        result.Apply(context);
                    }
                }
            }
            if (string.Equals(modelType, "Field", StringComparison.OrdinalIgnoreCase))
            {
                var contentPart = content.ContentItem.Parts.Single(o => o.GetType().Name == partTypeName);
                var drivers     = FindFieldDrivers(contentPart, fieldTypeName);

                foreach (var driver in drivers)
                {
                    var result = driver.UpdateEditorShape(context);

                    if (result != null)
                    {
                        result.Apply(context);
                    }
                }
            }

            // Get the Drivers for the Field or the Part that we are trying to talk to.
            return(itemShape);
        }
Esempio n. 11
0
        public override async Task <IDisplayResult> UpdateAsync(TModel model, UpdateEditorContext context)
        {
            var section = GetSection(model);

            var result = await UpdateAsync(model, section, context.Updater, context);

            if (result == null)
            {
                return(null);
            }

            if (context.Updater.ModelState.IsValid)
            {
                model.Properties[PropertyName] = JObject.FromObject(section);
            }

            return(result);
        }
        DriverResult IContentPartDriver.UpdateEditor(UpdateEditorContext context)
        {
            var part = context.ContentItem.As <TContent>();

            if (part == null)
            {
                return(null);
            }

            DriverResult result = Editor(part, context.Updater, context.New);

            if (result != null)
            {
                result.ContentPart = part;
            }

            return(result);
        }
Esempio n. 13
0
 protected override void UpdateEditorShape(UpdateEditorContext context)
 {
     base.UpdateEditorShape(context);
     if (context.ContentItem.As <MailchimpSubscriptionPart>() != null)
     {
         try {
             _service.CheckAcceptedPolicy(context.ContentItem.As <MailchimpSubscriptionPart>());
         }
         catch (MissingPoliciesException) {
             context.Updater.AddModelError("MissingPolicies", T("You have to accept all required policies in order to subscribe to the newsletter."));
             _modelIsValid = false;
         }
         catch (Exception ex) {
             context.Updater.AddModelError("GenericPolicies", T("You have to accept all required policies in order to subscribe to the newsletter."));
             context.Logger.Log(LogLevel.Error, ex, "CheckAcceptedPolicy throws an error.", null);
             _modelIsValid = false;
         }
     }
 }
Esempio n. 14
0
        public async Task UpdateEditorAsync(ContentItem model, UpdateEditorContext context)
        {
            foreach (var displayDriver in _displayDrivers)
            {
                try
                {
                    var result = await displayDriver.UpdateEditorAsync(model, context);

                    if (result != null)
                    {
                        result.Apply(context);
                    }
                }
                catch (Exception ex)
                {
                    InvokeExtensions.HandleException(ex, Logger, displayDriver.GetType().Name, "BuildDisplayAsync");
                }
            }
        }
Esempio n. 15
0
        public override async Task <IDisplayResult> UpdateAsync(User user, UpdateEditorContext context)
        {
            var userClaim = _httpContextAccessor.HttpContext.User;

            foreach (var contentTypeDefinition in GetContentTypeDefinitions())
            {
                if (!await _authorizationService.AuthorizeAsync(userClaim, CustomUserSettingsPermissions.CreatePermissionForType(contentTypeDefinition)))
                {
                    continue;
                }

                var isNew       = false;
                var contentItem = await GetUserSettingsAsync(user, contentTypeDefinition, () => isNew = true);

                await _contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, isNew);

                user.Properties[contentTypeDefinition.Name] = JObject.FromObject(contentItem);
            }

            return(await EditAsync(user, context));
        }
Esempio n. 16
0
        public async Task <dynamic> UpdateEditorAsync(IUpdateModel updater, string groupId)
        {
            var actualShapeType = "Settings" + "_Edit";
            var site            = await _siteService.GetSiteSettingsAsync();

            dynamic itemShape = CreateContentShape(actualShapeType);

            var context = new UpdateEditorContext(
                itemShape,
                groupId,
                _shapeFactory,
                _layoutAccessor.GetLayout(),
                updater
                );

            await BindPlacementAsync(context);

            await _handlers.InvokeAsync(handler => handler.UpdateEditorAsync(site, context), Logger);

            return(context.Shape);
        }
        public async Task <IShape> UpdateEditorAsync(ContentItem contentItem, IUpdateModel updater, bool isNew, string groupId, string htmlFieldPrefix)
        {
            if (contentItem == null)
            {
                throw new ArgumentNullException(nameof(contentItem));
            }

            var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType);
            var stereotype            = contentTypeDefinition.Settings.ToObject <ContentTypeSettings>().Stereotype;
            var actualShapeType       = (stereotype ?? "Content") + "_Edit";

            dynamic itemShape = await CreateContentShapeAsync(actualShapeType);

            itemShape.ContentItem = contentItem;

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

            var context = new UpdateEditorContext(
                itemShape,
                groupId,
                isNew,
                htmlFieldPrefix,
                _shapeFactory,
                await _layoutAccessor.GetLayoutAsync(),
                new ModelStateWrapperUpdater(updater)
                );

            await BindPlacementAsync(context);

            var updateContentContext = new UpdateContentContext(contentItem, updater);

            await _contentHandlers.InvokeAsync(async handler => await handler.UpdatingAsync(updateContentContext), Logger);

            await _handlers.InvokeAsync(async handler => await handler.UpdateEditorAsync(contentItem, context), Logger);

            await _contentHandlers.Reverse().InvokeAsync(async handler => await handler.UpdatedAsync(updateContentContext), Logger);

            return(context.Shape);
        }
Esempio n. 18
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            JToken property;

            var contentTypeDefinition = _contentTypeDefinitions.Value.FirstOrDefault(x => x.Name == context.GroupId);

            if (contentTypeDefinition == null)
            {
                return(null);
            }

            var user = _httpContextAccessor.HttpContext?.User;

            if (!await _authorizationService.AuthorizeAsync(user, Permissions.CreatePermissionForType(contentTypeDefinition)))
            {
                return(null);
            }

            ContentItem contentItem;
            bool        isNew;

            if (!site.Properties.TryGetValue(contentTypeDefinition.Name, out property))
            {
                contentItem = await _contentManager.NewAsync(contentTypeDefinition.Name);

                isNew = true;
            }
            else
            {
                // Create existing content item
                contentItem = property.ToObject <ContentItem>();
                isNew       = false;
            }

            await _contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, isNew);

            site.Properties[contentTypeDefinition.Name] = JObject.FromObject(contentItem);

            return(await EditAsync(site, context));
        }
Esempio n. 19
0
        public bool WasDisplayed(UpdateEditorContext context)
        {
            ShapeDescriptor descriptor;

            if (context.ShapeTable.Descriptors.TryGetValue(_shapeType, out descriptor))
            {
                var placementContext = new ShapePlacementContext {
                    Content        = context.ContentItem,
                    ContentType    = context.ContentItem.ContentType,
                    Differentiator = _differentiator,
                    DisplayType    = null,
                    Path           = context.Path
                };

                var placementInfo = descriptor.Placement(placementContext);

                var location = placementInfo.Location;

                if (String.IsNullOrEmpty(location) || location == "-")
                {
                    return(false);
                }

                var editorGroup = _groupId;
                if (String.IsNullOrEmpty(editorGroup))
                {
                    editorGroup = placementInfo.GetGroup() ?? "";
                }

                var contextGroup = context.GroupId ?? "";

                if (!String.Equals(editorGroup, contextGroup, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 20
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            if (context.GroupId == GroupId)
            {
                var model = new SiteSettingsViewModel();

                if (await context.Updater.TryUpdateModelAsync(model, Prefix))
                {
                    site.SiteName          = model.SiteName;
                    site.BaseUrl           = model.BaseUrl;
                    site.TimeZoneId        = model.TimeZone;
                    site.UseCdn            = model.UseCdn;
                    site.CdnBaseUrl        = model.CdnBaseUrl;
                    site.ResourceDebugMode = model.ResourceDebugMode;
                    site.AppendVersion     = model.AppendVersion;

                    await _shellHost.ReloadShellContextAsync(_shellSettings);
                }
            }

            return(Edit(site));
        }
        public override async Task <IDisplayResult> UpdateAsync(ISite model, UpdateEditorContext context)
        {
            var user = _httpContextAccessor.HttpContext?.User;

            if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageNotificationSettings))
            {
                return(null);
            }

            if (context.GroupId == GroupId)
            {
                var viewmodel = new AzureHubSettingsViewModel();
                await context.Updater.TryUpdateModelAsync(viewmodel, Prefix);

                if (!string.IsNullOrWhiteSpace(viewmodel.NotificationTags))
                {
                    model.Properties.TryAdd(nameof(AzureHubSettingsViewModel.NotificationTags),
                                            JArray.FromObject(viewmodel.NotificationTags.Split(',').Select(t => t.Trim())));
                }
                else
                {
                    model.Properties.Remove(nameof(AzureHubSettingsViewModel.NotificationTags));
                }

                var settings = new AzureHubSettings
                {
                    Hub        = viewmodel.Hub,
                    Connection = viewmodel.Connection
                };

                await _tenantConfigStore.SaveAsync(GroupId, settings);

                // Reload the tenant to apply the settings
                await _orchardHost.ReloadShellContextAsync(_currentShellSettings);
            }

            return(await EditAsync(model, context));
        }
Esempio n. 22
0
        public async Task <dynamic> UpdateEditorAsync(ContentItem contentItem, IUpdateModel updater, string groupInfoId)
        {
            if (contentItem == null)
            {
                throw new ArgumentNullException(nameof(contentItem));
            }

            var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType);
            var stereotype            = contentTypeDefinition.Settings.ToObject <ContentTypeSettings>().Stereotype;
            var actualShapeType       = stereotype ?? "Content" + "_Edit";

            dynamic itemShape = CreateContentShape(actualShapeType);

            itemShape.ContentItem = contentItem;

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

            var context = new UpdateEditorContext(
                itemShape,
                groupInfoId,
                _shapeFactory,
                _layoutAccessor.GetLayout(),
                updater
                );

            await BindPlacementAsync(context);

            var updateContentContext = new UpdateContentContext(contentItem);

            _contentHandlers.Invoke(handler => handler.Updating(updateContentContext), Logger);

            await _handlers.InvokeAsync(handler => handler.UpdateEditorAsync(contentItem, context), Logger);

            _contentHandlers.Reverse().Invoke(handler => handler.Updated(updateContentContext), Logger);

            return(context.Shape);
        }
Esempio n. 23
0
        public override async Task <IDisplayResult> UpdateAsync(ContentItem model, UpdateEditorContext context)
        {
            var viewModel = new LayerMetadataEditViewModel();

            await context.Updater.TryUpdateModelAsync(viewModel, Prefix);

            if (viewModel.LayerMetadata == null)
            {
                return(null);
            }

            if (String.IsNullOrEmpty(viewModel.LayerMetadata.Zone))
            {
                context.Updater.ModelState.AddModelError("LayerMetadata.Zone", S["Zone is missing"]);
            }

            if (context.Updater.ModelState.IsValid)
            {
                model.Apply(viewModel.LayerMetadata);
            }

            return(await EditAsync(model, context));
        }
        public override async Task <IDisplayResult> UpdateAsync(User user, UpdateEditorContext context)
        {
            if (!await AuthorizeUpdateAsync(user))
            {
                return(Edit(user));
            }

            var model = new EditUserInformationViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix))
            {
                // Do not use the user manager to set these values, or validate them here, as they will validate at the incorrect time.
                // After this driver runs the IUserService.UpdateAsync or IUserService.CreateAsync method will
                // validate the user and provide the correct error messages based on the entire user objects values.

                // Custom properties should still be validated in the driver.

                user.UserName = model.UserName;
                user.Email    = model.Email;
            }

            return(Edit(user));
        }
Esempio n. 25
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            var contentTypeDefinition = _customSettingsService.GetSettingsType(context.GroupId);

            if (contentTypeDefinition == null)
            {
                return(null);
            }

            if (!await _customSettingsService.CanUserCreateSettingsAsync(contentTypeDefinition))
            {
                return(null);
            }

            var isNew       = false;
            var contentItem = await _customSettingsService.GetSettingsAsync(site, contentTypeDefinition, () => isNew = true);

            await _contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, isNew);

            site.Properties[contentTypeDefinition.Name] = JObject.FromObject(contentItem);

            return(await EditAsync(site, context));
        }
        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));
        }
Esempio n. 27
0
        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 context = new UpdateEditorContext(itemShape, content, updater, groupInfoId, _shapeFactory);

            BindPlacement(context, null, stereotype);

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

            return(context.Shape);
        }
Esempio n. 28
0
        protected override void UpdateEditorShape(UpdateEditorContext context)
        {
            if (!string.Equals("markdown", context.GroupId, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var part = context.ContentItem.As <MarkdownSiteSettingsPart>();

            if (part == null)
            {
                return;
            }

            base.UpdateEditorShape(context);

            var blogPost = _contentDefinitionManager.GetTypeDefinition("BlogPost");

            if (blogPost == null)
            {
                return;
            }

            var bodyPart = blogPost.Parts.FirstOrDefault(x => x.PartDefinition.Name == "BodyPart");

            if (bodyPart == null)
            {
                return;
            }

            _contentDefinitionManager.AlterTypeDefinition("BlogPost", build => build
                                                          .WithPart("BodyPart", cfg => cfg
                                                                    .WithSetting("BodyTypePartSettings.Flavor", part.UseMarkdownForBlogs ? "markdown" : "html")
                                                                    )
                                                          );
        }
Esempio n. 29
0
        public override async Task <IDisplayResult> UpdateAsync(ISite site, UpdateEditorContext context)
        {
            if (context.GroupId == GroupId)
            {
                var model = new SiteSettingsViewModel();

                if (await context.Updater.TryUpdateModelAsync(model, Prefix))
                {
                    site.SiteName          = model.SiteName;
                    site.BaseUrl           = model.BaseUrl;
                    site.TimeZoneId        = model.TimeZone;
                    site.Culture           = model.Culture;
                    site.UseCdn            = model.UseCdn;
                    site.ResourceDebugMode = model.ResourceDebugMode;
                }

                // We always reset the tenant for the default culture and also supported cultures to take effect
                await _shellHost.ReloadShellContextAsync(_shellSettings);

                _notifier.Warning(H["The site has been restarted for the settings to take effect"]);
            }

            return(Edit(site));
        }
Esempio n. 30
0
        public async Task UpdateEditorAsync(IContent content, string groupInfoId)
        {
            if (content == null || content.ContentItem == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            var    contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(content.ContentItem.ContentType);
            JToken stereotype;

            if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
            {
                stereotype = "Content";
            }

            var actualShapeType = stereotype + "_Edit";

            dynamic itemShape = CreateContentShape(actualShapeType);

            itemShape.ContentItem = content.ContentItem;

            var theme = await _themeManager.GetThemeAsync();

            var shapeTable = _shapeTableManager.GetShapeTable(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, groupInfoId, _shapeFactory);

            await BindPlacementAsync(context, null, stereotype.Value <string>());

            await _handlers.InvokeAsync(handler => handler.UpdateEditorAsync(context), Logger);

            return;
        }
 public virtual void UpdateEditor(UpdateEditorContext context) {}