Auto-created columns from 'ctrl'
New in version 13.3
Field definitions (columns) are now added to the
TCA by default if they are not
explicitly set in Table properties (ctrl) sections in the base TCA php files. TYPO3 creates
them automatically, meaning developers no longer have to create lots of
boilerplate fields definitions.
ctrl settings such as the enablecolumns and
languageField settings require explicit TCA
columns definitions.
Warning
Columns in the ctrl section of the TCA that have been auto-created still need to be added manually to palettes and types definitions.
Due to the TCA loading order
these columns are only created if the ctrl property has been
added to the original definition in the base Configuration/ file.
Setting them in the overrides like Configuration/
has no effect.
Load order when building TCA
The TCA is loaded in the following steps:
- Load php files from extension
Configuration/filesTCA - NEW - Enrich
columnsfromctrlsettings - Load php files from extension
Configuration/filesTCA/ Overrides - Apply TCA migrations
- Apply TCA preparations
The loading sequence means that only columns fields in the
ctrl section of
Configuration/ files are auto-created, not in Configuration/.
These fields should be set in the "base" php files only:
adding them at a later point - for example in another extension - is brittle
and there is a risk the main extension can not handle auto-creation properly.
Overriding definitions from auto-created TCA columns
In most cases, developers should not need to change
columns definitions
auto-created by the Core and it isn't recommended. If you do want to change
them, stick to "display" related details only.
There are two options for adding your own definitions. Either by defining
a column in a "base" TCA file (Configuration/) - the Core will not override it.
Or, a developer can decide to let the Core auto-create a column, but
then override single properties in Configuration/ files.
For example, if this is a
pages "base" file (loading step 1):
the Core creates this
columns definition (loading step 2):
<?php
$GLOBALS['TCA']['pages']['columns']['disabled'] = [
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.enabled',
'exclude' => true,
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 0,
'items' => [
[
'label' => '',
'invertStateDisplay' => true,
],
],
],
];
When an editor creates a new page, it should be "disabled" by default
so that the new page does not go online before it is properly set up.
Add the following in the Configuration/ file: