Field types¶
The Content Block field types mirror the available TCA types. Some types have been renamed to better reflect the actual usage. For the most part options are identical. There are some additional options, which are not available in TCA to ease the usage.
Common field options¶
Field options, which can be defined inside the fields
array.
-
identifier
¶ -
- Required
-
true
- Type
-
string
The field's identifier has to be unique within a Content Block. Exception is within a collections' field array, as this starts a new scope.
Warning
Avoid using dashes "-" inside your identifiers. They are not guaranteed to be escaped in the database. We recommend to always use snake case.
fields: identifier: my_identifier type: Text
Copied!
-
type
¶ -
- Required
-
true
- Type
-
string
The field's type. See Field types.
fields: identifier: my_identifier type: Text
Copied!
-
label
¶ -
- Required
-
false
- Type
-
string
By default labels should be defined inside the
Labels.xlf
file. But in case there is only one language for the backend you may define labels directly in the YAML configuration. Translation files have precedence over this.fields: identifier: my_identifier type: Text label: Static label
Copied!
-
description
¶ -
- Required
-
false
- Type
-
string
The same as for
label
above.fields: identifier: my_identifier type: Text description: Static description
Copied!
-
useExistingField
¶ -
- Required
-
false
- Type
-
bool
If set to true, the identifier is treated as an existing field from the Core or your own defined field in TCA. To learn more about reusing fields read this article.
fields: identifier: bodytext useExistingField: true
Copied!
-
prefixField
¶ -
- Required
-
false
- Type
-
boolean
- Default
-
true
If set to false, the prefixing is disabled for this field. This overrules the global option prefixFields.
fields: identifier: my_identifier type: Text prefixField: false
Copied!
-
prefixType
¶ -
- Required
-
false
- Type
-
string
- Default
-
full
Determines how to prefix the field if local
prefixField
or globalprefixFields
is enabled. Can be eitherfull
(default) orvendor
.fields: identifier: my_identifier type: Text prefixField: true prefixType: vendor
Copied!
-
displayCond
¶ -
- Required
-
false
- Type
-
string|array
- Default
-
''
Can be used to display the field only under certain conditions. Please have a look at the official documentation for more information.
# Simple, only one rule. displayCond: 'FIELD:identifier:=:value'
Copied!# Multiple rules combined with AND. displayCond: AND: - 'FIELD:identifier:=:value' - 'FIELD:another_identifier:=:1'
Copied!Tip
Fields used in a condition should have the column option
onChange
set toreload
.
-
onChange
¶ -
- Required
-
false
- Type
-
string
- Default
-
''
Can be used to trigger a reload of the Content Type when this specific field is changed. Should be used, if a rule of
displayCond
is used for this field.onChange: reload
Copied!