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

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

            configOptions?.Invoke(options);

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

            return(schema);
        }