예제 #1
0
        public override void Validate(string fieldName, ContentFieldOptions options, ValidationContext context)
        {
            HtmlFieldOptions fieldOptions = (HtmlFieldOptions)options;

            if (fieldOptions.IsRequired && HasValue == false)
            {
                context.AddRequireValidation(fieldName);
            }
        }
예제 #2
0
        public static TContentSchema AddHtml <TContentSchema>(this TContentSchema schema, string name, Action <HtmlFieldOptions>?configOptions = null)
            where TContentSchema : IContentSchema
        {
            HtmlFieldOptions options = new HtmlFieldOptions();

            configOptions?.Invoke(options);

            schema.AddField <HtmlField>(name, options, null);

            return(schema);
        }