4.6.2. Presentation in the administration

The <display> element is mandatory and lets you determine how a content type should behave when listed in the administrative pages.

Each piece of content is displayed with a link that you click to open that item for editing. It is up to you to define the text of this link, using a mix of plain text and content from the various fields. A simple example:

<display>
  <link>
    <field ref="filenumber" />
    <text>: </text>
    <field ref="title" />
  </link>
</display>

This snippet will take the filenumber field, append a colon and a space, and then append the value of the title field. <field> elements use the ref attribute to refer to a field in the type, and <text> elements are just plain text that you can use to separate values from fields. This concatenated string will then be used as the link in the content list.

In addition, <field> elements can use the format attribute to perform minimal formatting of the field values. Currently only two formatting options are supported:

Table 35. format options

ValueDescription
boldPuts the field value in bold type.
dateFormats the field value as a date. This should be applied for date fields only. In fact you don't have to yet, as date fields will automatically be formatted as dates, but in the future you will be able to determine the format of the date as well.

Putting it all together you could do something like this:

<display>
  <link>
    <field ref="date" format="date" />
    <text> </text>
    <field ref="filenumber" format="bold" />
    <text>: </text>
    <field ref="title" />
  </link>
</display>

This should all go right after the <sorting> section in your XML:

<?xml version="1.0" encoding="utf-8"?>
<contentType id="document">
  <title lang="en" number="single">Document</title>
  <title lang="en" number="plural">Documents</title>
  <title lang="da" number="single">Dokument</title>
  <title lang="da" number="plural">Dokumenter</title>

  <sorting direction="asc" fieldName="filenumber" type="field" />

  <display>
    <link>
      <field format="bold" ref="filenumber" />
      <text>: </text>
      <field ref="title" />
    </link>
  </display>

  <fields>

     ...

  </fields>

</contentType>

Important

Remember to delete all linkField-attributes in your fields if you use this mechanism. As long as there is a field marked as linkField, this will take precedence.