public override void UpdateFieldSettings(string fieldType, string fieldName, SettingsDictionary settingsDictionary, IUpdateModel updateModel) { if (fieldType != "BooleanField") { return; } var model = new BooleanFieldSettings(); if (updateModel.TryUpdateModel(model, "BooleanFieldSettings", null, null)) { UpdateSettings(model, settingsDictionary, "BooleanFieldSettings"); settingsDictionary["BooleanFieldSettings.SelectionMode"] = model.SelectionMode.ToString(); settingsDictionary["BooleanFieldSettings.DependencyMode"] = model.DependencyMode.ToString(); settingsDictionary["BooleanFieldSettings.DefaultValue"] = model.DefaultValue.ToString(); } }
public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.FieldType != "BooleanField") { yield break; } var model = new BooleanFieldSettings(); if (updateModel.TryUpdateModel(model, "BooleanFieldSettings", null, null)) { UpdateSettings(model, builder, "BooleanFieldSettings"); builder.WithSetting("BooleanFieldSettings.SelectionMode", model.SelectionMode.ToString()); builder.WithSetting("BooleanFieldSettings.DependencyMode", model.DependencyMode.ToString()); builder.WithSetting("BooleanFieldSettings.DefaultValue", model.DefaultValue.ToString()); } yield return DefinitionTemplate(model); }