Exemplo n.º 1
0
        public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            if (builder.FieldType != "TaxonomyField") {
                yield break;
            }

            var model = new TaxonomyFieldSettings();

            if (updateModel.TryUpdateModel(model, "TaxonomyFieldSettings", null, null))
            {
                builder
                    .WithSetting("TaxonomyFieldSettings.Taxonomy", model.Taxonomy)
                    .WithSetting("TaxonomyFieldSettings.LeavesOnly", model.LeavesOnly.ToString())
                    .WithSetting("TaxonomyFieldSettings.SingleChoice", model.SingleChoice.ToString())
                    .WithSetting("TaxonomyFieldSettings.Hint", model.Hint);
            }

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

            var model = new TaxonomyFieldSettings();

            if (updateModel.TryUpdateModel(model, "TaxonomyFieldSettings", null, null))
            {
                builder
                .WithSetting("TaxonomyFieldSettings.Taxonomy", model.Taxonomy)
                .WithSetting("TaxonomyFieldSettings.LeavesOnly", model.LeavesOnly.ToString())
                .WithSetting("TaxonomyFieldSettings.SingleChoice", model.SingleChoice.ToString())
                .WithSetting("TaxonomyFieldSettings.Hint", model.Hint);
            }

            yield return(DefinitionTemplate(model));
        }