Previously I blogged about New property types in EPiServer CMS R2 Beta. It led to a little discussion in the comments. Specifically Erik Nordin asked if it was possible to set the custom settings through code.
Well after a little quality time with reflector I’ve found out how. On publishing a page the code will look for a “Select list (multiple selection)” control called ChildPages. If one is found then it sets the list of available options to the child pages of the current page (value is the page ID and text is the page name). This could be useful in scenarios where editors need to feature a page but we want to give them something simple and/or controlled to work with.
Obviously this is a very quick demo but I am sure this can be expanded out for several uses.
This code was written in EPiServer CMS 6 R2 beta but approach should work on EPiServer CMS 6.
This hasn’t been anywhere near a production box and has been tested for all of 30 seconds. Also it is running on the current beta so use at your risk.