The ContentType attribute is required for all content types. It is located in the EPiServer.DataAnnotations namespace and has the following configurable properties.
Property | Description | Default value |
AvailableInEditMode |
Defines whether you can create content of this type in edit view. |
true |
Description |
Text that describes the function of the ContentType. |
NULL |
DisplayName |
The name shown in edit view for this ContentType. |
NULL |
Order |
The sort order used to determine the ContentType’s position in listings. |
100 |
GUID |
Identifier for the ContentType. You can match the code definition to an existing definition in the database. |
Guid.Empty |
GroupName |
Name for grouping ContentTypes when you display them for selection in edit view. |
NULL |
Access
The optional Access attribute defines which users, roles, and visitor groups 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.
Note: If the Access attribute is not present, any user (who has edit access) can create content of the specific type.
Property | Description | Behavior if not specified |
Users, Roles, VisitorGroups |
Defines which users, roles, and visitor groups have access rights. |
No user has access to ContentType. |
Access |
Defines the level of access to grant. |
ContentTypes support access level Create only. |
The following image shows how the attribute properties are mapped to settings in admin view.
AvailableContentTypesAttribute
Use AvailableContentTypesAttributes to set which content types are available under a content instance; it has the following configurable properties.
Property | Description | Default value |
Availability |
Defines whether all or no content types are available. If you set none, other settings on the attribute is ignored. |
Availability.All |
Include |
A type array of typed content to specify which content types are 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 are not available under a content instance of the type with the attribute. |
Type[0] |
IncludeOn |
States that the content with this attribute is available under the typed content in the type array. |
Type[0] |
ExcludeOn |
States that the content with this attribute is not available under any of the typed content in the type array. |
Type[0] |
The types given on Include, Exclude, IncludeOn and ExcludeOn can be either a typed content directly or it can be the type of an interface or a base class. At registration, registered types that can be assigned to the specified type are included. For example, if an interface is specified in an Include list, then typed pages that implement the interface are included.
The following image shows how Include differs from IncludeOn and how they are mapped in admin view.
- Include excludes typed content except that which is specified.
- IncludeOn does not exclude any content type for types that have all content types available.
Do you find this information helpful? Please log in to provide feedback.