In large scale projects we usually define several content types. I some cases i did struggle with dozens. For most of the types we are allowed to create just few types of child pages. For example ArticleList could be a parent page for Articles and Articles Archive. From editors perspective it’s easy to work with limited number of types. But by default when creating new page we get list of all available page types. To limit the list we can use AvailableContentTypes attribute. It allows us to include or exclude types from list of available content types.

For example if we want to allow creating Product pages under SectionPage we could set Include option.

When the project development is almost done, it’s good to do the overview and check if all of available are set properly. It quite difficult to achieve by analyzing the code because types can be included, but also excluded. We could also use admin mode Page Types section.

Admin mode Section available pages

… but then we can check only page by page.

That is why I prepared an admin mode plugin that shows grid with all available content types.

Available Content Types Grid

Iterating through available content types

First we need to get list of all page types. It can be loaded using IContentTypeRepository repository. The List method returns all content types – Pages, Blocks and Media. We need to filter collection by pages.
Then, for each page type, we need to get all available content types. It can be easy implemented using ContentTypeAvailabilityService. At the end we get one quite long expression:

The list shows all content types for user currently logged to Admin mode.

Testing Alloy demo

I run the plugin on Alloy demo site. I created new page type SectionPage and set allowed children types as ProductPage. Only one checked item appeared under Section page.

Section page available types

I also noticed that Contact page allows contains Start page as a child.

Start page under Contacts report

I double checked this in edit mode and it turned out that it’s really possible :). Probably Start Page type should not be allowed there.

StartPage under Contacts

Below is full source code of plugin.

The code behind:

and markup: