Blog about tips & tricks for CMS enhancement

eric.petersson

Use built in backing typed properties for Optimizely CMS 12


If you have been looking for some default built in properties for extending your editor's needs such as choosing from weekdays or page types, search no more - this post has got you covered!

More default properties you say? 🤔

If you have a look at the default shipped and built in Optimizely properties at the developer community guidelines you find most of the available properties to choose from. Reading more about the BackingType attribute for the decleration of your properties signifies the PropertyData type to store the value of the property in the database.

The documentation specifically says: "The backing type will be auto determined".

Well, what if we tried to specifically load in a different backing property type back from the old days by having a scrutinized look beneath the surface of the SpecializedProperties section in the Episerver namespace? 😄 Here are the results of what I found - and once again some "hidden" old gems of the former Episerver platform in favour of the new Optimizely CMS 12:

PageType

Choose from the site's available page types as a drop down list:

Select page type as property setting
public virtual PageType PageType { get; set; }

Languge

Select the site's available language support as a list of selection:

Select site language as property
[BackingType(typeof(PropertyLanguage))]
public virtual string LanguageSelector { get; set; }

Frame

The Optimizely built in selection for how to open up an anchor link with the options of "Open in a new tab or window" or "Open in the full body of the window":

Select frame as openingtype as property
[BackingType(typeof(PropertyFrame))]
public virtual int Frames { get; set; }

Category

Just as the always shipped and non hidden Category, this property does just like that - displays all available categories:

Select custom categories as property
[CultureSpecific]
public virtual CategoryList Categories { get; set; }

Weekday

Selection of the weekdays spawning from Monday to Sunday as checkbox selection list:

Select days of week as property
[UIHint(UIHint.Legacy)]
public virtual Weekday Days { get; set; }

Sort order for pages

The default Optimizely sort order options listed in the Settings tab at the tip of your fingers:

Select sort order as property
[BackingType(typeof(PropertySortOrder))]
public virtual Enum PageSortOrder { get; set; }

Property on current page

Render a checkbox selection list of all the properties on the current page type:

Select all of the current properties of the page, as a property!
[CultureSpecific]
[BackingType(typeof(PropertySelector))]
public virtual string ChoosenProperties { get; set; }

These properties certainly are not new for the Optimizely CMS 12 but they do serve a purpose to get some more love from days of darkness they have been given so far 😉

Happy coding! ❤️