close

Filter

loading table of contents...

Content Server Manual / Version 2110

Table Of Contents

4.2.2 Inheriting Content Types

CoreMedia CMS has an inheritance concept for content types and properties. In the <DocType> element, there is an optional attribute, Parent. If this attribute is set to the name of another content type, the new content type inherits all fields of its parent content. A property in the inheriting content item with the same name and type as a property in the parent item will override the parent's property. You have to set the attribute Override to true in a Property element to use overriding. Overriding is only possible if it specializes the type of the property.

  • Strings of the inheriting content type have to be shorter or equal.

  • blobs must use a more specific MIME type.

  • XML grammars must be a child of the parents XML grammar.

  • For link lists, the link type must be a subtype of the parent's link type or the parent must be untyped.

In addition, a content type can be defined as abstract. For it, the attribute Abstract must be set to "true" in the <DocType> element. By default, a content type is defined as not abstract. A content of abstract type cannot be created by the server.

The following example shows the content type Image and a special type, ImageWithThumbnail, which offers the field Thumbnail in addition for a reduced version of the image.

<DocType Name="Image">
  <IntProperty Name="Width"/>
  <IntProperty Name="Height"/>
  <BlobProperty Name="Image" MimeType="image/*"/> 
</DocType>

<DocType Name="ImageWithThumbnail" Parent="Image">
  <BlobProperty Name="Thumbnail" MimeType="image/*"/> 
</DocType>

Example 4.5. Example for content type inheritance


In this way, content items offer the usual flexibility of the object-oriented world: according to the context, you can allow general or special content types in link lists or templates.

For good system performance, however, you should not inflate the inheritance tree with too many generic intermediate types, but limit this to types which will actually be required in the foreseeable future.

The order of the type definitions is relevant to inheritance: a content type used as the parent type must be defined previously. In this way, cyclic construction of inheritance relationships is ruled out.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.