Integrity

In N2 there is a mechanism to restrict which types of items can be created below which. As you might expect this is done using attributes.

Parent type constraints

By default any items can be created below any other but lets say we dont want the start page from the previous examples to be placed below any other page. This would be done like this: 

No parent items allowed

But wait. Now we can't create a start page below another start page. And that thinking about it this isn't really what I want. I want the first few levels of pages to be allowed. So how would this look?

Start page allowed below start page

Now I can create a start page directly below another start page but not below a text page.

Child type constraints

In certain situations it's useful to override the parent type constraint and let the parent decide which items it allows. For these situations there's the N2.Integrity.AllowedChildren attribute. 

Zone constraints 

In N2 there's a feature that allows placing items in "zones". This is useful when we want to split a page into one item that represents a page and several sub-items that represents parts of this page. An example of this are the teaser items on the start page of this site. 

Consider this content item.

An item that is allowed in a zone

The AllowedZones attribute tells the N2 engine that this items only is allowed in the zone "RightColumn". The edit interface will not show the option of creating this item outside this zone.

An item with a zone

To tie things up I must also make this "RightColumn" available. This is done with an attribute on the parent item.

This zone is by the way stored in the ZoneName property on the child item.