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

            if (fieldOptions.IsRequired && HasValue == false)
            {
                context.AddRequireValidation(fieldName);
            }
        }
        public static TContentSchema AddBool <TContentSchema>(this TContentSchema schema, string name, Action <BoolFieldOptions>?configOptions = null)
            where TContentSchema : IContentSchema
        {
            BoolFieldOptions options = new BoolFieldOptions();

            configOptions?.Invoke(options);

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

            return(schema);
        }