public override void Validate(string fieldName, ContentFieldOptions options, ValidationContext context) { HtmlFieldOptions fieldOptions = (HtmlFieldOptions)options; if (fieldOptions.IsRequired && HasValue == false) { context.AddRequireValidation(fieldName); } }
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); }