N2CMS: Limit the number of ContentItems of a certain type below another ContentItem

I am using N2CMS and I have two classes that inherit from ContentItem - for example HomePage and NewsPage. NewsPage is only set in the HomePage section (using the RestrictParents attribute):

[RestrictParents(typeof(HomePage))]

      

Can I make it so that the maximum number of NewsPages (in this case 1) is below the home page?

+3


source to share


1 answer


The answer is that you can use

[RestrictCardinality] 

      



attribute. In the example I gave in the question, you should use

[RestrictCardinality(ComparableType=typeof(NewsPart), MaximumCount=1)]

      

+3


source







All Articles