More About Defining Fields
The content-type
element you will use most frequently
is almost certainly the field
element. It is also one
of the more complicated elements in the content-type resource, so it is
probably worth looking at it more closely.
The field
element has a type
attribute that determines what type of data the field will accept. The
main type
values are:
basic
-
Accepts any string data, including XHTML fragments. This is the default field type.
number
-
Accepts only numbers.
boolean
-
Accepts only Boolean (true/false) values.
enumeration
-
Accepts only values from a predefined list.
uri
-
Accepts only URIs.
date
-
Accepts only date/time values.
schedule
-
Accepts only schedule definitions.
collection
-
Accepts only values from an atom feed.
The type of a field determines not only what kind of data it is capable of accepting, but also:
-
What kind of constraints can be placed on the input data
-
What kind of child elements the
field
element may contain -
What kind of data the field returns when accessed from a template, and therefore how the field is best accessed.
These types are described in more detail in the following sections. Also discussed are field arrays, complex fields and hidden fields.
Changing field type for any given field that is currently in use, is not supported. The behaviour if done is undefined.
For a complete list of all available field types, see here.