Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
Maybe you can prepare a custom validator like:
public class CustomPageValidator : IValidate<MyPageType> { IEnumerable<ValidationError> IValidate<MyPageType>.Validate(MyPageType page) { bool blocksValidationCondition = .... validation condition .... if (!blocksValidationCondition) { return new[] { new ValidationError() { ErrorMessage = "Cannot publish page", PropertyName = page.GetPropertyName(pg => pg.IntroText), Severity = ValidationErrorSeverity.Warning, ValidationType = ValidationErrorType.AttributeMatched } }; } return Enumerable.Empty<ValidationError>(); } }
I have a question regarding publishing blocks and publishing pages; that is, how I control validation on when a block can be published, and when a page can be published.
I want to be able have a set of criteria that are imposed in order that a block can be published. I think this is done using property level validation; mandatory, not mandatory etc.
However, a page can consist of multiple blocks, some of which are mandatory for a page, and others are optional.
How do I validate page publishing validation based on block "state".
Thanks in advance.
Barry