Built-in property types
Describes how to use built-in property types in your models and also create your own property types.
Optimizely Content Management System (CMS) content is built up by models with properties that store and present data. You can use many built-in property types in your models and create your own.
Common property types
What you want to create | Solution | Editing experience | Hints and tips |
---|---|---|---|
Plain short text | String  property | One row input | Control the allowed length with the StringLength  attribute. Use custom tag to control the containing tag, such as using a H1 for the main header for the page. |
Plain long text | String  property with UIHint.Textarea | Text area | Control the allowed length with the StringLength  attribute. |
Html | XHtmlString  property | A TinyMCE HTML editor |  |
Integer value | Int  property | A number slider | Controls other rendering, such as the number of items in a list. Control the min and max values with the Range  attribute. |
Date and time | DateTime  property | A date and time picker | Control the min and max values with the Range  attribute. |
Double | Double  property | Check editor | Control the min and max values with the Range  attribute. |
Boolean | Boolean  property | Check box |  |
Page type | PageType property |  | Filter items in a list, and so on. |
BLOB | Â Blob property | Â | Hold binary data (such as an image). Route to a BLOB with pattern /BlobPropertyName. |
Work with other content
To refer to existing content, use the Link
 or LinkCollection
 to create internal or external links.
- Use
ContentArea
to display content from other content. - Use
ContentReference
,ContentReferenceList
, orURL
to link to a single content of a specified type. - Use theÂ
AllowedTypes
 attribute to further restrict the kind of links that are possible to add to a property (although there are a few known limitations).
Use a content reference with many different UI hints to select different entities in CMS, such as a block, a media item, a block folder, or a media folder.
What you want to create | Solution | Editing experience | Hints and tips |
---|---|---|---|
Link to a page | PageReference  property | Content picker with drag and drop support |  |
Link to a media file of any type | ContentReference  property with UIHint.MediaFile | Content picker with drag and drop support | Link to any file in the media repository. Use ContentReference instead of using standard content rendering. (Mostly for backwards compatibility.) |
Link to an image | ContentReference  property with UIHint.Image | Content picker with drag and drop support | Lets an editor select content in the media repository by implementing IContentImage . |
Link to a video | ContentReference  property with UIHint.Video | Content picker with drag and drop support | Lets an editor select content in the media repository by implementing IContentVideo . |
Link to a media file with the possibility to append information in the URL | Url  property with UIHint.MediaFile  or UIHint.Image  or UIHint.Video | Content picker with drag and drop support | Each link can be an item inside CMS, such as pages or media but also external URLs. Use URL instead of ContentReference if you want to add information, such as query string parameters, to control size. |
Content area | ContentArea  property |  |  |
URL | Url  property | Link dialog with drag-and-drop support |  |
Link to multiple external and/or internal resources | LinkItemCollection  property | Link collection editor with drag-and-drop support | Does not support AllowedTypesAttribute . |
Link to multiple internal pages, media files, or another content type. | ContentReferenceList property | Content picker with drag and drop support | Supports AllowedTypesAttribute . |
Select predefined values
You can use the following solutions to create drop-down lists and check box lists:
What you want to create | Solution | Editing experience | Hints and tips |
---|---|---|---|
Select a single item from a relatively short list of options | String /Int property with SelectOne attribute | Link to implementation page |  |
Select several items from a relatively short list of options | String /Int property with SelectMany attribute | Link to implementation page |  |
Select a single item from a relatively long list of options | String /Int property with AutoSuggestion attribute | Link to implementation page | Use with caution because the auto-suggestion editor creates requests to the server. |
Validation attributes
CMS supports the following validation attributes that are part of the .NET:
Range
StringLength
RegularExpression
EmailAttribute
You can create custom attributes that implement ValidationAttribute
.
Updated 7 months ago