Basic field (Simplified)
Defines a basic field. A basic field can contain text of any kind. You can, however, use the mime-type attribute to specify the allowed content more narrowly.
Syntax
<field name="NCName" id="NCName"? type="basic" mime-type="text" > <constraints>...</constraints>? ANY-FOREIGN-ELEMENT* <parameter/>* <rep:representations>...</rep:representations>? </field>
Only one form of the constraints
element may be used:
Text constraints.
Examples
This example defines a plain text field used to hold the title of an article.
<field mime-type="text/plain" type="basic" name="title"> <ui:label>Title</ui:label> <ui:description>The title of the article</ui:description> <constraints> <required>true</required> </constraints> </field>
This example defines an HTML text field used to hold the main body of an article. Note the use of the
ui:style
element to control the appearance ofh1
elements in the field in Content Studio. You can specify a complete stylesheet inside this element.<field mime-type="application/xhtml+xml" type="basic" name="body"> <ui:label>Body</ui:label> <ui:description>The body text of the article.</ui:description> <ui:style>h1 {color:red;}</ui:style> </field>
This example shows how a basic
field
is used to define image crop masks.<field mime-type="application/json" type="basic" name="representations"> <ui:label>Image Versions</ui:label> <rep:representations type="image-versions"> <rep:representation name="thumbnail"> <rep:output width="100" height="100"/> <rep:crop/> <rep:resize/> </rep:representation> <rep:representation name="narrow"> <rep:output width="500" height="400"/> <rep:crop/> <rep:resize/> </rep:representation> <rep:representation name="wide"> <rep:output width="1000" height="800"/> <rep:crop/> <rep:resize/> </rep:representation> </rep:representations> </field>
Attributes
name="
NCName"
-
The name of the
field
element. Note that no twofield
s belonging to the samepanel
may have the same name. id="
NCName"
(optional)-
The id of the
field
element. Set this attribute if you want to be able to reference this element using XInclude. Otherwise it is not required. type="
basic"
-
Specifies that this field is a basic field.
mime-type="
text"
-
The MIME type of the field. Two values are supported by default:
text/plain
(default)-
A simple text editing field is displayed in Content Studio for this MIME type.
application/xhmtl+xml
-
A rich text editing field is displayed in Content Studio for this MIME type.
application/json
-
If the field also has a child
rep:representations
element, then an image cropping field is displayed in Content Studio for this MIME type.The field will not display any value if it contains any invalid data.
You can, however, define MIME types of your own and write corresponding field editor plug-ins.