Table of contents
ContentType
The required attribute for content types is simply called ContentType, and is located in the EPiServer.DataAnnotations namespace. The configurable properties for the attribute are displayed below.
Property name | Description | Default value |
AvailableInEditMode |
Defines if you should be able to create content of this type in edit view. |
true |
Description |
A short text that describes the function of the ContentType. |
NULL |
DisplayName |
The name shown in edit view for content of this type. |
NULL |
Order |
The sort order used to determine the ContentType’s position in listings. |
100 |
GUID |
Identifier for the content type. Can be used to match the code definition to an existing definition in the database. |
Guid.Empty |
GroupName |
Name for grouping content types when displaying them for selection in edit view. |
NULL |
Access
The optional Access attribute defines which users, roles, and visitor groups that will have access rights to create content of a specific type in the user interface. Filtering based on this attribute is applied after ordinary access rights on content.
Property name | Description | Behavior if not specified |
Users, Roles, VisitorGroups |
Defines which users, roles, and visitor groups that will have access rights. |
No user have access to content type |
Access |
Defines level of access to grant |
Content types only support access level Create. |
The following image shows how the attribute properties are mapped to settings in admin view.
AvailableContentTypes
There is an additional optional attribute for content types called AvailableContentTypes that can be used to set which content types that should be available under a content instance. The configurable properties for the attribute are displayed below.
Property name | Description | Default value |
Availability |
Defines if all or none content types should be available. If none is set other settings on the attribute is ignored. |
Availability.All |
Include |
A type array of typed content to specify which content types that should be available under a content instance of the type with the attribute. |
Type[0] |
Exclude |
A type array of typed content to specify which content types that should not be available under a content instance of the type with the attribute. |
Type[0] |
IncludeOn |
States that the content with this attribute should be available under the all the typed content in the type array. |
Type[0] |
ExcludeOn |
States that the content with this attribute should be not available under the any of the typed content in the type array. |
Type[0] |
The types given on Include, Exclude, IncludeOn and ExcludeOn can either be a typed content directly or it can be the type of an interface or a base class. At registration all registered types that can be assigned to the specified type will be included. For example, if an interface is specified in Include list then all typed pages that implement the interface will be included.
IncludeOn differs from Include in the way that it is not excluding. That is for types in IncludeOn that has all content types available no content types will be excluded. Include on the other hand will exclude all typed content except the ones given in Include. Below is an image that shows how Included and IncludeOn are mapped to settings in admin view.
Exclude works so that if no types are set on Included then the result will be that all registered page types except the Exclude ones are available. If there are types registered in Include then all types in Include except the ones in Exclude are available. Below is an image that shows how Exclude and ExcludeOn are mapped to settings in admin view.
Below is an image that shows how Availability is mapped to settings in admin view.
ImageUrl
The attribute called ImageUrl can be used to set the icon for content types. Icon is visible in the user interface when creating new content.
Property name | Description | Default value |
Path |
The path to the icon to use for the page type. |
NULL |
Do you find this information helpful? Please log in to provide feedback.