2012-05-11

In my previous post, I talked about how to assign properties (fields) to tabs in EPiServer using PageTypeBuilder. Property types such as Drop Down Lists or the XHTML Editor usually need some additional configurations (such as what values to display/restrict in the drop down menu). This is usually done in the EPiServer Admin mode graphical interface. But in version 1.0 of PageTypeBuilder, this couldn't be done; you had to go to the Admin mode interface to do individual configurations manually, one-by-one, defeating the purpose of synchronizing the Page Types between environments automatically.

Fortunately, PageTypeBuilder 2.0 introduced a mechanism to configure properties by implementing the PageTypeBuilder.IUpdatePropertySettings<T> interface. An Attribute class (i.e., that inherits from System.Attribute) must implement this interface. The "T" type in the generic IUpdatePropertySettings interface declaration must be an EPiServer property settings class, such as EPiServer.Web.PropertyControls.PropertySettings.MultipleOptionsListSettings or EPiServer.Editor.TinyMCE.TinyMCESettings.

The following example shows how to create a Drop Down List configuration class that defines the values that can be chosen from the list:

Once defined, the attribute class can be used in the declaration of a property in a Page Type class:

The following example configures the TinyMCE editor for XHTML properties to display the "formatting" drop down list in the toolbar, uses the stylesheet declaration in the project's "/css/style.css" for the styles drop down menu, and defines the size of the editor:

Once defined, use the attribute in the declaration of a XHTML property in a Page Type class:

You can find information about the TinyMCE configurations by searching the web, since TinyMCE is a standard JS-based editor not developed by EPiServer.

Show more