I had the need to categorize pages in several different “dimensions”, grouped as subcategories. I wanted to display these categories in different properties, but I didn’t want to display the whole category tree in each property (it’s quite large), or have the editor set all the dimensions in the same property. For this purpose I wanted to display only configurable part of the category tree.
This property type is a simple extension of the PropertyCategory which finds the subtree “root” based on the name of the property. Another way could have been to use the default value, but that only allows the numerical category ID which could be cumbersome to find.
2:/// Shows a subtree of the category tree based on the name of the property.
3:/// If the property name is aaa-NN or aaa-SSS the number NN or the string SSS
4:/// is used to find a category and the subtree below that category
32:// Return the category child categories if the category was found
33:if (subRoot != null)
39:// No category specified or found, fall back to default behaviour
So say I have a category tree which is [Root] – Dimensions – Technologies – [Available categories for technology here]. I then create a property called “Category-Technologies” (or “Category-14” if 14 is the ID of Technologies) of the sub category property type. Then only the subtree below Technologies will be displayed in edit mode. Neat, isn’t it?