Auto-created columns from 'ctrl'
New in version 13.3
Default definitions of Field definitions (columns) required by Table properties (ctrl) settings are
now automatically added to TCA
if not manually
configured. Extension developers can now remove and avoid a significant amount
of boilerplate field definitions in Field definitions (columns) and rely on TYPO3 core to create
them automatically when dropping TYPO3 v12.4 support.
Certain ctrl
settings, such as the enablecolumns and
languageField settings require TCA columns
definitions.
Warning
Columns created automatically by being defined in the ctrl section of the TCA still need to be added manually to the palettes and types definition.
Due to the TCA loading order
these columns are only created if the according ctrl property was added in
the original definition in Configuration/
, not
if they were defined in the overrides like Configuration/
.
Load order when building TCA
To understand if and when TCA column auto-creation from ctrl
definitions
kicks in, it is important to have an overview of the order of the single loading
steps:
- Load single files from extension
Configuration/
filesTCA - NEW - Enrich
columns
fromctrl
settings - Load single files from extension
Configuration/
filesTCA/ Overrides - Apply TCA migrations
- Apply TCA preparations
As a result of this strategy, columns
fields are not auto-created, when
a ctrl
capability is added in a Configuration/
file, and not in a Configuration/
"base" file. In general, such
capabilities should be set in base files only: Adding them at a later point - for
example in a different extension - is brittle and there is a risk the main
extension can not deal with such an added capability properly.
Overriding definitions from auto-created TCA columns
In most cases, developers do not need to change definitions of columns
auto-created by the Core. In general, it is advisable to not actively do this.
Developers who still want to change detail properties of such columns should
generally stick to "display" related details only.
There are two options to have own definitions: When a column is already defined
in a "base" TCA file (Configuration/
), the Core will not override it.
Alternatively, a developer can decide to let the Core auto-create a column, to
then override single properties in Configuration/
files.
As example, "base" pages
file defines this (step 1 above):
The Core thus creates this columns
definition (step 2 above):
<?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 to
avoid having a new page online in the website before it is set up completely.
A Configuration/
file does this: