Record Types¶
Folder: ContentBlocks/RecordTypes
.
Record Types are generic Content Types in TYPO3. Basically everything, which is
not defined by the TYPO3 Core itself. Adding custom records requires you to
define a table
name. A minimal example looks like this:
name: example/my-record-type
table: tx_vendor_my_record_type
labelField: title
fields:
-
identifier: title
type: Text
This example will create a new table tx_vendor_my_record_type
. Usually Record
Types are added in folders, so you first have to create a new folder in the page
tree. After that, you can switch to the List module and click
"Create new record". There you will find your newly created Record Type.
Tip
If you prefix your table with tx_
, TYPO3 will assume this record belongs
to an extension and will group it separately by the extension title. This is
either taken from ext_emconf.php
(title) or composer.json
(description).
Otherwise, the record will be grouped under "System Records".
It is also possible to allow creation of Record Types in normal pages. For that
you have to enable ignorePageTypeRestriction
:
name: example/my-record-type
table: my_record_type
labelField: title
security:
ignorePageTypeRestriction: true
fields:
-
identifier: title
type: Text
In order to create multiple types for a single Record Type, it is required to
define a typeField
field and a typeName
. The type field will be
created automatically and added at the top of your editing interface as a select
dropdown. The different types will be also added automatically to the list:
name: example/diver
table: person
typeField: type
typeName: diver
fields:
-
identifier: title
type: Text
name: example/instructor
table: person
typeField: type
typeName: instructor
fields:
-
identifier: title
type: Text
Collections¶
Collections are a field type, which you can only
define in the fields
array. They will create custom tables automatically
and use the identifier
as table name. Therefore they don't require you
to define a table
. Collections are always hidden in the List module.
This is controlled by the aggregateRoot
setting. Usually Collections
only have one type. To realise multiple types it is recommended to extract the
definition to a separate Record Type and use foreign_table
instead.
Options¶
- table¶
- Required
true (false for Collections)
- Type
string
The custom table name to be used for the new Record Type. The table name for Collections is determined by the
identifier
and thus should not be defined there.table: tx_vendor_my_custom_table_name
- typeField¶
- Required
false
- Type
string
The field identifier to use as the type switch. This field will be automatically generated and prepended as the very first field. The item list is filled automatically as well. There is no need to define this field manually in your fields list. Useful, if you want to define multiple types for a single table (single table inheritance). Collections don't need this option, as they usually only have one type.
typeField: type
- typeName¶
- Required
false
- Type
string
- Default
automatically generated from
name
The identifier of the new Record Type. It is automatically generated from the name, if not defined manually.
typeName: type1
- labelField¶
- Required
true
- Type
string|array
Defines which field should be used as the title of the record. If not defined, the first valid child field will be used as the label. It is possible to define an array of fields, which will be displayed comma-separated in the backend.
# a single field for the label labelField: title # multiple fields will be displayed comma-separated labelField: - title - text
- fallbackLabelFields¶
- Required
false
- Type
array
Defines which fields should be used as fallback, if
labelField
is not filled. The first filled field which is found will be used. Can only be used if there is only onelabelField
field defined.# fallback fields will be used, if title from labelField is empty labelField: title fallbackLabelFields: - text1 - text2
- aggregateRoot¶
- Required
false
- Type
boolean
- Default
true (false for Collections)
By default, all tables are treated as
aggregateRoot
. This means, this table is not a child-table of another root. By assigning this option thefalse
value, additional fields are created to enable a reference to a parent table:foreign_table_parent_uid
,tablenames
andfieldname
. Now, a type Collection field can defineforeign_table
with this table. When referencing an existing table, you need to take care yourself that these fields exist. Also, non-aggregate tables are hidden in the List module.# set this for Record Types if they should be used as `foreign_table` in Collections aggregateRoot: false
- languageAware¶
- Required
false
- Type
boolean
- Default
true
If set to
false
, language related fields are not created. Namelysys_language_uid
,l10n_parent
,l10n_source
andl10n_diffsource
.# disable language support languageAware: false
- workspaceAware¶
- Required
false
- Type
boolean
- Default
true
If set to
false
, workspace related fields are not created. Namelyt3ver_oid
,t3ver_wsid
,t3ver_state
andt3ver_stage
.# disable workspaces support workspaceAware: false
- editLocking¶
- Required
false
- Type
boolean
- Default
true
If set to
false
, the functionality to lock the editing for editors is removed. This refers to theeditlock
field.# disable edit lock field editLocking: false
- restriction¶
- Required
false
- Type
array
- Default
true (for all sub properties)
There are several restrictions in TYPO3, which filter records by certain constraints.
disabled
Adds a checkbox to hide the record in the frontend.
startTime
Adds a date picker to set the start time when to display the record.
endTime
Adds a date picker to set the end time when to stop displaying the record.
userGroup
Adds a selection to choose user groups, which are allowed to view the record.
restriction: disabled: false startTime: true endTime: true userGroup: false
- softDelete¶
- Required
false
- Type
boolean
- Default
true
When deleting records in the TYPO3 backend, they are not really deleted in the database. They are merely flagged as deleted. Disabling this option, removes this safety net.
# records will be really deleted in the backend softDelete: false
- trackCreationDate¶
- Required
false
- Type
boolean
- Default
true
Tracks the timestamp of the creation date. Disabling this option removes this information.
trackCreationDate: false
- trackUpdateDate¶
- Required
false
- Type
boolean
- Default
true
Tracks the timestamp of the last update. Disabling this option removes this information.
trackUpdateDate: false
- trackAncestorReference¶
- Required
false
- Type
boolean
- Default
true
If set to
false
, the tracking field for the original record will not be created. Namelyt3_origuid
.trackAncestorReference: false
- sortable¶
- Required
false
- Type
boolean
- Default
true
Tracks the order of records. Arrows will appear to sort records explicitly. Disabling this option removes this functionality. This corresponds to the TCA option
sortby
.sortable: false
- sortField¶
- Required
false
- Type
string|array
- Default
true
The field identifier to use for sorting records. If set, this will disable the
sortable
option automatically. This corresponds to the TCA optiondefault_sortby
. It is possible to define multiple sorting fields with an array.# simple sort by one field in ascending order sortField: title # sorting by multiple fields with different orders sortField: - identifier: title order: desc - identifier: text order: asc
- internalDescription¶
- Required
false
- Type
boolean
- Default
false
If enabled, this adds a new tab
Notes
with a description field. When filled with text, a record information will be displayed in the editing view. This corresponds with the TCA ctrl optiondescriptionColumn
. This field is supposed to be used only for the backend.internalDescription: true
- rootLevelType¶
- Required
false
- Type
string
- Default
onlyOnPages
Restricts the place, where the record can be created. Possible values are
onlyOnPages
(default),onlyOnRootLevel
andboth
. This corresponds to the TCA ctrl optionrootLevel
.rootLevelType: 'onlyOnRootLevel'
- security¶
- Required
false
- Type
array
ignoreWebMountRestriction
default false, Allows users to access records that are not in their defined web-mount, thus bypassing this restriction.
ignoreRootLevelRestriction
default false, Allows non-admin users to access records that are on the root-level (page ID 0), thus bypassing this usual restriction.
ignorePageTypeRestriction
default false (but true if
aggregateRoot
is false e.g. for Collection fields), Allows to use the record on any kind of page type.
security: ignoreWebMountRestriction: true ignoreRootLevelRestriction: true ignorePageTypeRestriction: true
- readOnly¶
- Required
false
- Type
boolean
- Default
false
If enabled, the record can not be edited in the TYPO3 backend anymore.
readOnly: true
- adminOnly¶
- Required
false
- Type
boolean
- Default
false
If enabled, only admins can edit the record.
adminOnly: true
- hideAtCopy¶
- Required
false
- Type
boolean
- Default
false
If enabled, the record will be disabled, when copied. Only works, if
restriction.disabled
is set totrue
.hideAtCopy: true
- appendLabelAtCopy¶
- Required
false
- Type
string
If set, the label field
labelField
will be appended with this string, when copied.appendLabelAtCopy: append me