public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
     if (builder.FieldType != "LinkField") {
         yield break;
     }
     
     var model = new LinkFieldSettings();
     if (updateModel.TryUpdateModel(model, "LinkFieldSettings", null, null)) {
         builder.WithSetting("LinkFieldSettings.Hint", model.Hint);
         builder.WithSetting("LinkFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
         builder.WithSetting("LinkFieldSettings.TargetMode", model.TargetMode.ToString());
         builder.WithSetting("LinkFieldSettings.LinkTextMode", model.LinkTextMode.ToString());
         builder.WithSetting("LinkFieldSettings.StaticText", model.StaticText);
     
         yield return DefinitionTemplate(model);
     }
 }
예제 #2
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.FieldType != "LinkField")
            {
                yield break;
            }

            var model = new LinkFieldSettings();

            if (updateModel.TryUpdateModel(model, "LinkFieldSettings", null, null))
            {
                builder.WithSetting("LinkFieldSettings.Hint", model.Hint);
                builder.WithSetting("LinkFieldSettings.Required", model.Required.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("LinkFieldSettings.TargetMode", model.TargetMode.ToString());
                builder.WithSetting("LinkFieldSettings.LinkTextMode", model.LinkTextMode.ToString());
                builder.WithSetting("LinkFieldSettings.StaticText", model.StaticText);

                yield return(DefinitionTemplate(model));
            }
        }