About Content Types

The primary function of the content-type XML file is to define the types of content item allowed in a particular publication. The content item types are defined in content-type elements, which can look something like this:

  <content-type name="file">
    <ui:label>File</ui:label>
    <ui:title-field>title</ui:title-field>
    <panel name="main">
      <field mime-type="text/plain" type="basic" name="title">
        <ui:label>Title</ui:label>
        <constraints>
          <required>true</required>
        </constraints>
      </field>
      <field mime-type="text/plain" type="basic" name="description">
        <ui:label>Description</ui:label>
      </field>
      <field name="binary" type="link">
        <ui:label>File</ui:label>
        <relation>com.escenic.edit-media</relation>
        <constraints>
          <mime-type>application/pdf</mime-type>
          <mime-type>text/*</mime-type>
        </constraints>
      </field>
    </panel>
    <summary>
      <field name="title" type="basic" mime-type="text/plain"/>
      <field name="description" type="basic" mime-type="text/plain"/>
    </summary>
  </content-type>

This defines a simple content type for representing uploaded file attachments in CUE. It has three fields: a title, a description and a binary field used to hold an internal link to the uploaded file. The three field definitions don't belong directly to the content type element, but to a panel called main. Panels are used to organize content item fields into groups for display on separate tabs in CUE. A field element must have a name attribute and a type attribute that defines what kind of data can be store in the field. The mime-type field provides a more detailed type definition for basic fields.

The binary field's constraints element specifies what kinds of file the field supports: CUE will only allow files of the specified types to be uploaded.

The summary element defines a set of fields intended to be used when the content item appears as a relation in another content item or a teaser on a section page. It is usually a subset of the content item's main fields as in the example above.

The above content type is very simple. A content type definition can contain many more fields, spread across many panels, and the fields themselves can have complex internal structures that hold multiple values.