public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.Name != "ConnectorPart") { yield break; } var model = new ConnectorTypePartSettings(); updateModel.TryUpdateModel(model, "ConnectorTypePartSettings", null, null); builder.WithSetting("ConnectorTypePartSettings.AllowMany", model.AllowMany.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowNone", model.AllowNone.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowDuplicates", model.AllowDuplicates.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowedContentLeft", model.AllowedContentLeft); builder.WithSetting("ConnectorTypePartSettings.AllowedContentRight", model.AllowedContentRight); builder.WithSetting("ConnectorTypePartSettings.InverseConnectorType", model.InverseConnectorType); builder.WithSetting("ConnectorTypePartSettings.DefaultParadigms", model.DefaultParadigms); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayName", model.SocketDisplayName); builder.WithSetting("ConnectorTypePartSettings.SocketEditorHint", model.SocketEditorHint); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayHint", model.SocketDisplayHint); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayType", model.SocketDisplayType); builder.WithSetting("ConnectorTypePartSettings.SocketGroupName", model.SocketGroupName); builder.WithSetting("ConnectorTypePartSettings.ConnectorDisplayType", model.ConnectorDisplayType); yield return(DefinitionTemplate(model)); }
public ConnectorDescriptor(Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition connectorDefinition, ConnectorTypePartSettings settings = null) { // Store def Definition = connectorDefinition; // Initialize lazies _PartDefinition = new Lazy<ContentTypePartDefinition>(() => { var partDef = Definition.Parts.Where(p => p.PartDefinition.Name == "ConnectorPart").FirstOrDefault(); if (partDef == null) throw new ArgumentException("Connector definition must have ConnectorPart"); return partDef; }); if (settings != null) { _Settings = new Lazy<ConnectorTypePartSettings>(() => settings); } else { _Settings = new Lazy<ConnectorTypePartSettings>(() => PartDefinition.Settings.GetModel<ConnectorTypePartSettings>()); } }
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.Name != "ConnectorPart") yield break; var model = new ConnectorTypePartSettings(); updateModel.TryUpdateModel(model, "ConnectorTypePartSettings", null, null); builder.WithSetting("ConnectorTypePartSettings.AllowMany", model.AllowMany.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowNone", model.AllowNone.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowDuplicates", model.AllowDuplicates.ToString()); builder.WithSetting("ConnectorTypePartSettings.AllowedContentLeft", model.AllowedContentLeft); builder.WithSetting("ConnectorTypePartSettings.AllowedContentRight", model.AllowedContentRight); builder.WithSetting("ConnectorTypePartSettings.InverseConnectorType", model.InverseConnectorType); builder.WithSetting("ConnectorTypePartSettings.DefaultParadigms", model.DefaultParadigms); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayName", model.SocketDisplayName); builder.WithSetting("ConnectorTypePartSettings.SocketEditorHint", model.SocketEditorHint); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayHint", model.SocketDisplayHint); builder.WithSetting("ConnectorTypePartSettings.SocketDisplayType", model.SocketDisplayType); builder.WithSetting("ConnectorTypePartSettings.SocketGroupName", model.SocketGroupName); builder.WithSetting("ConnectorTypePartSettings.ConnectorDisplayType", model.ConnectorDisplayType); yield return DefinitionTemplate(model); }