PageTypePropertyGroup for PageTypeBuilder v2
Some time last year myself and my colleague Mark Everard were discussing features that we thought were missing from PageTypeBuilder.
We concluded the most important feature to us that was missing was the ability to have reusable groups of properties that could be re-used on Page Types.
So as I have a abundant amount of time durning my daily commute I implemented the necessary changes with the help of Mark to add the new PageTypePropertyGroup’s feature.
Last week I had a word with Joel and he suggested I implement the necessary changes into the latest version of the source.
Although the PropertyGroups’s are fairly self explanatory and easy to use I just thought I would blog about using the functionality as a couple of the properties relating to some of the attributes were not exposed
If for example I had an Image Link component that I wanted to use on various page types I would first create an ImageLink class that will implement the interface PageTypePropertyGroup. You will notice that the properties within the class will be implemented in the same way by decorating the properties with the PageTypeProperty attribute like the following:
We can then add the ImageLink property groups properties to a page type in the following way:
You will see in the code sample above that when adding the property group to the page type you will need to decorate the property with the PageTypePropertyGroup attribute.
The PageTypePropertyGroup has the following two properties:
- EditCaptionPrefix – This defines a prefix which will be added to the edit caption. If the code above was used an example of a rendered edit caption would be “Image Link one – Image Url.
- StartSortOrderFrom – This property is used to define the starting sort order for the property group. If a value for this property has defined the FieldOrder for the property will essentially be the value of PageTypePropertyGroup.StartSortOrderFrom + PageTypeProperty.SortOrder.
Once the code is compiled and PageTypeBuilder works it’s magic the following properties will be available:
The properties can be accessed from the CurrentPage in the following way:
Please feel free to email or twitter myself with any feedback @croweman