public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "MediaPickerField") {
                yield break;
            }

            var model = new MediaPickerFieldSettings();
            if (updateModel.TryUpdateModel(model, "MediaPickerFieldSettings", null, null)) {
                builder.WithSetting("MediaPickerFieldSettings.Hint", model.Hint);
                builder.WithSetting("MediaPickerFieldSettings.AllowedExtensions", model.AllowedExtensions);
                builder.WithSetting("MediaPickerFieldSettings.Required", model.Required.ToString());
                builder.WithSetting("MediaPickerFieldSettings.Custom1", model.Custom1);
                builder.WithSetting("MediaPickerFieldSettings.Custom2", model.Custom2);
                builder.WithSetting("MediaPickerFieldSettings.Custom3", model.Custom3);
            }

            yield return DefinitionTemplate(model);
        }
Пример #2
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.FieldType != "MediaPickerField")
            {
                yield break;
            }

            var model = new MediaPickerFieldSettings();

            if (updateModel.TryUpdateModel(model, "MediaPickerFieldSettings", null, null))
            {
                builder.WithSetting("MediaPickerFieldSettings.Hint", model.Hint);
                builder.WithSetting("MediaPickerFieldSettings.AllowedExtensions", model.AllowedExtensions);
                builder.WithSetting("MediaPickerFieldSettings.Required", model.Required.ToString());
                builder.WithSetting("MediaPickerFieldSettings.Custom1", model.Custom1);
                builder.WithSetting("MediaPickerFieldSettings.Custom2", model.Custom2);
                builder.WithSetting("MediaPickerFieldSettings.Custom3", model.Custom3);
            }

            yield return(DefinitionTemplate(model));
        }