I have a block type which I am using on a specific content area on a specific page. is there any way that I can validate(on page level or contentarea level) that block is not used more than once?
How to restrict the number of a blocktype used in contentarea?
1k Views Asked by SWAZ At
2
Here's a sample validation attribute class that should help. I am working on a "Validation Rules" nuget package that I thought could include this. I only included the "Min by object type" rule but will add more before it's released.
Class:
Sample application on a content area:
Result in editor view when invalid (prevents publish):