Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
Record types
type
-
- Type
- string (field name)
- Path
- $GLOBALS['TCA'][$table]['ctrl']
- Scope
- Display / Proc.
Field name, which defines the "record type".
The value of this field determines which one of the types configurations are used for displaying the fields in the FormEngine. It will probably also affect how the record is used in the context where it belongs.
The most widely known usage of this feature is the case of Content Elements where the Type: selector is defined as the "CType" field and when you change that selector you will also get another rendering of the form:
It is used for example by the "doktype" field in the "pages" table.
On changing the value of the field defined in
type
the user gets prompted to reload the record.Only one type field can be defined. If you need to reload the record on changing another field, see property onchange.
It is also possible to make the type depend on the value of a related record, for example to switch using the type field of a foreign table. The syntax is
relation_
. For example thefield: foreign_ type_ field sys_
table takes its type from thefile_ metadata sys_
table.file
Examples
the type stored in a field

The table tx_
table from the "examples" extension defines different types. The field used for differentiating
the types is the "record_type" field. Hence we have the following in the ['ctrl']
section
of the tx_examples_dummy table:
[
'ctrl' => [
'title' => 'Form engine - type',
'label' => 'input_1',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'sortby' => 'sorting',
'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
'versioningWS' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'translationSource' => 'l10n_source',
'enablecolumns' => [
'disabled' => 'hidden',
],
'type' => 'record_type',
],
]
The "record_type" field can take values ranging from 0 to 2. Accordingly we define types for the same values. Each type defines which fields will be displayed in the BE form:
[
'types' => [
0 => [
'showitem' => 'record_type, input_1, text_1',
],
'withChangedFields' => [
'showitem' => 'record_type, input_1, input_2, text_1',
],
'withColumnsOverrides' => [
'showitem' => 'record_type, input_1, input_2, text_1',
'columnsOverrides' => [
'input_2' => [
'label' => 'input_2, readOnly, size=10, empty renderType',
'config' => [
'renderType' => '',
'readOnly' => true,
'size' => 10,
],
],
'text_1' => [
'config' => [
'renderType' => 't3editor',
'format' => 'html',
],
],
],
],
],
]
See the section about types for more details.
Type in relation to a foreign table's field

The following table tx_
stores its relation to
the table tx_
in the field foreign_
.
The type of the table tx_
comes from the content
of the field tx_
of the related field.
The type is therefore defined via type = 'foreign_
.
The control section of the table tx_
looks like
this:
[
'ctrl' => [
'title' => 'Form engine - type from foreign table',
'label' => 'input_1',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'sortby' => 'sorting',
'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
'versioningWS' => true,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'translationSource' => 'l10n_source',
'enablecolumns' => [
'disabled' => 'hidden',
],
'type' => 'foreign_table:record_type',
],
]
The field foreign_
in the same table is a normal singleSelect field.
It can be any kind of 1 - 1 or 1 - n relation.
[
'columns' => [
'foreign_table' => [
'label' => 'type from foreign table',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_styleguide_type',
'minitems' => 1,
'maxitems' => 1,
'size' => 1,
],
],
],
]