我在自定义模块中添加了MediaLibraryPicker字段,我想要使这个字段成为必需。请帮我。
ContentDefinitionManager.AlterPartDefinition("UserProfilePart", part => part
.WithField("Photo", field => field
.OfType("MediaLibraryPickerField")
.WithDisplayName("User Photo")));
提交表格时。用户需要从媒体库中选择至少一个图像。
答案 0 :(得分:2)
我添加了MediaLibrary Picker Field的设置并且工作正常。
ContentDefinitionManager.AlterPartDefinition("UserProfilePart", part => part
.WithField("Photo", field => field .OfType("MediaLibraryPickerField"
.WithDisplayName("User Photo").WithSetting("MediaLibraryPickerFieldSettings.Required", "true")))
答案 1 :(得分:1)
添加.WithSetting(“必需”,“真”)