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.

Load order when building TCA 

The TCA is loaded in the following steps:

  1. Load php files from extension Configuration/TCA files
  2. NEW - Enrich columns from ctrl settings
  3. Load php files from extension Configuration/TCA/Overrides files
  4. Apply TCA migrations
  5. Apply TCA preparations

The loading sequence means that only columns fields in the ctrl section of Configuration/TCA files are auto-created, not in Configuration/TCA/Overrides. 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/TCA) - 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/TCA/Overrides files.

For example, if this is a pages "base" file (loading step 1):

EXT:core/Configuration/TCA/pages.php (Excerpt)
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'disabled',
        ],
    ],
    // ...
];
Copied!

the Core creates this columns definition (loading step 2):

Column entries created by the Core
<?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,
            ],
        ],
    ],
];
Copied!

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/TCA/Overrides/pages.php file:

EXT:my_extension/Configuration/TCA/Overrides/pages.php
<?php

// New pages are disabled by default
$GLOBALS['TCA']['pages']['columns']['disabled']['config']['default'] = 1;
Copied!