London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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