コード例 #1
0
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "EnumerationField") {
                yield break;
            }

            var model = new EnumerationFieldSettings();
            if (updateModel.TryUpdateModel(model, "EnumerationFieldSettings", null, null)) {
                builder.WithSetting("EnumerationFieldSettings.Hint", model.Hint);
                builder.WithSetting("EnumerationFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("EnumerationFieldSettings.Options", model.Options);
                builder.WithSetting("EnumerationFieldSettings.ListMode", model.ListMode.ToString());
            }

            yield return DefinitionTemplate(model);
        }
コード例 #2
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.FieldType != "EnumerationField")
            {
                yield break;
            }

            var model = new EnumerationFieldSettings();

            if (updateModel.TryUpdateModel(model, "EnumerationFieldSettings", null, null))
            {
                builder.WithSetting("EnumerationFieldSettings.Hint", model.Hint);
                builder.WithSetting("EnumerationFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("EnumerationFieldSettings.Options", model.Options);
                builder.WithSetting("EnumerationFieldSettings.ListMode", model.ListMode.ToString());
            }

            yield return(DefinitionTemplate(model));
        }