5.2. Common Field Attributes

A number of attributes are valid for all field types:

Table 31. Common field attributes

AttributeDescriptionRequired?
id

The unique id within the current type. This is used to identify content fields when you retrieve content with M2_Content::get().

Yes
multiLingual

0 or 1. If set to 1, the field will be used across all languages at the site. For sites running only one language this is of no importance.

Yes
type

One of the types listed in Section 5.1, “Field Types”.

Yes
searchable

Set to 1 or 0 to determine whether or not the field should be indexed if you choose to let the search app index this content type.

No
display

One of:

  • NORMAL

  • HIDDEN: Hidden in the interface. This is useful if you use M2_Content::put() to manage content that should not reveal all data in the administration.

  • STATIC: Will be displayed but can not be edited.

No
linkField

If set to 1, this field is used as the title line for the item in administrative overview lists.

No (one field in your type must be linkField)
toggleWithSelect

Use this attribute to show or hide a field depending on the selection in another field which is a select box.

In this example, the field image will only be visible if useimage has yes selected.

...

  <field id="image" type="image" multiLingual="0" toggleWithSelect="useimage:yes">
    <title lang="en">Image</title>
    <title lang="da">Billede</title>
  </field>

  <field id="useimage" type="select" multiLingual="0">
    <title lang="en">Use image</title>
    <title lang="da">Brug billede</title>

    <options lang="da">
      <option value="yes">Ja</option>
      <option value="no">Nej</option>
    </options>

    <options lang="en">
      <option value="yes">Yes</option>
      <option value="no">No</option>
    </options>
  </field>

...
No
toggleWithCheckbox

Works the same way as toggleWithSelect, only that it responds to another field which is presented as checkboxes.

No