TCA Reference

Version

main

Language

en

Author

TYPO3 contributors

License

This document is published under the Open Publication License.

Rendered

Mon, 02 Dec 2024 10:14:53 +0000


This document is the complete reference of the Table Configuration Array $GLOBALS['TCA'], which is a very central element of the TYPO3 architecture.


Table of Contents:

About table configuration

TCA Reference

Version

main

Language

en

Author

TYPO3 contributors

License

This document is published under the Open Publication License.

Rendered

Mon, 02 Dec 2024 10:14:53 +0000


This document is the complete reference of the Table Configuration Array $GLOBALS['TCA'], which is a very central element of the TYPO3 architecture.


Table of Contents:

About table configuration

Introduction

About this document

This document describes the global array called $GLOBALS['TCA'] . This array is a layer on top of the database tables that TYPO3 can operate on. It is a very central element of the TYPO3 architecture.

Almost all code examples used in this manual come either from the TYPO3 source code itself, from the extension examples, or from extension styleguide. Extension styleguide comes with a huge list of TCA examples and field combinations. Installing it locally in some test environment is a good idea since the extension is great as a "show-off" on what can be done with TCA. Even experienced developers will find things they did not know before.

What is $GLOBALS['TCA']?

The Table Configuration Array (or $GLOBALS['TCA'], TCA) is a global array in TYPO3 which extends the definition of database tables beyond what can be done strictly with SQL. First and foremost $GLOBALS['TCA'] defines which tables are editable in the TYPO3 backend. Database tables with no corresponding entry in $GLOBALS['TCA'] are "invisible" to the TYPO3 backend. The $GLOBALS['TCA'] definition of a table also covers the following:

  • Relations between that table and other tables
  • What fields should be displayed in the backend and with which layout
  • How should a field be validated (e.g. required, integer, etc.)
  • How a field is used in the frontend by Extbase and any extension that may refer to this information

TCA can be seen as the glue between the DataHandler which takes care of persisting data into the database, and the FormEngine which renders table rows in the Backend. TCA tells both of these main core constructs how they should behave for specific tables, fields and relations. Additionally, some parts of the Frontend rendering process also utilize TCA information, for instance the extbase MVC relies on it.

This array is highly extendable using extensions. Extensions can add fields to existing tables and add new tables. Several required extensions that are always loaded, already deliver some TCA files in their Configuration/TCA directories.

Most importantly, the extension "core" comes with a definition of pages, be_users and further tables needed by the whole system. The extension "frontend" comes with the tables tt_content, fe_users, sys_template and more. See the directories typo3/sysext/core/Configuration/TCA/ and typo3/sysext/frontend/Configuration/TCA/ for the complete list of the TYPO3 CMS tables.

The TCA definition of a new table with the name "database-table-name" must be done in the extension directory Configuration/TCA/ with database-table-name.php as filename. An example is EXT:sys_note/Configuration/TCA/sys_note.php for table "sys_note". This file will be found by the bootstrap code (if starting a TYPO3 request). It must return an array with the content of the TCA setting or NULL if the table should not be defined (depending on the extension's internal logic). The return value of any loaded file will be cached, so there must either be no dynamic PHP code in it or care must be taken to clear the system cache after each change in such files. See the t3api docs for more information on how extensions can add and change TCA.

The TYPO3 core bootstrap compiles the final TCA on first call by loading all files from the different locations, and caches the result. On subsequent calls this relatively huge array is then rather quickly loaded from cache and is made available as $GLOBALS['TCA'] in almost all normal access patterns like Frontend, Backend and CLI requests.

TCA main array structure

Table entries (first level)

The "first level" of the $GLOBALS['TCA'] array is made of the table names (as they appear in the database):

Here three tables, pages, tt_content and tx_examples_haiku are shown as examples.

Inside tables (second level)

Each table is further defined by an array which configures how the system handles the table, both for the display and the processing in the backend. The various parts on this second level are called "sections".

The general structure (looking at a single table) is as follows:

The following table provides a brief description of the various sections of $GLOBALS['TCA']['some_table'] . Each section is covered in more details in its own chapter.

['ctrl'] The table

The "ctrl" section contains properties for the table in general.

These are basically divided in two main categories:

  • properties which affect how the table is displayed and handled in the backend interface . This includes which icon, what name, which columns contains the title value, which column defines the type value etc.
  • properties which determine how it is processed by the system (TCE). This includes publishing control, "deleted" flag, whether the table can only be edited by admin-users, may only exist in the tree root etc.

For all tables configured in $GLOBALS['TCA'] this section must exist.

Full reference

['interface'] Backend interface handling

The "interface" section contains properties related to the tables display in the backend, mostly the Web > List module.

Full reference

['columns'] Individual fields

The "columns" section contains configuration for each table field (also called "column") which can be edited in the backend.

The configuration includes both properties for the display in the backend as well as the processing of the submitted data.

Each field can be configured as a certain "type" (e.g. checkbox, selector, input field, text area, file or db-relation field, user defined etc.) and for each type a separate set of additional properties applies. These properties are clearly explained for each type.

Full reference and ['config'] section.

['types'] Form layout for editing

The "types" section defines how the fields in the table (configured in the "columns" section) should be arranged inside the editing form; in which order, with which "palettes" (see below) and with which possible additional features applied.

Full reference

['palettes'] Palette fields order

A palette is just a list of fields which will be arranged horizontally side-by-side.

Full reference

Deeper levels

All properties on the second level either have their own properties or contain a further hierarchy.

In the case of the [columns] section, this will be the fields themselves. For the [types] and [palettes] section this will be the list of all possible types and palettes.

Properties scope

In the detail reference one or more scopes are given for each property. They indicate which area is affected by a given property. The various scopes are explained below:

Display
A "display" property will only affect the backend forms themselves. They have no impact on the values, nor on the database.
Proc.
This stands for "processing". Such properties have an impact on the values entered (for example, filtering them) or how they are written to the database (for example, dates transformed to time stamps).
Database
Such a property influences only the data type with regards to the database structure (for example, dates kept as datetime fields).
Search
Search properties are related to the general search feature provided by the TYPO3 backend.

Because some things never fit in precise categories, there may be properties with a special scope. The meaning will be explained in the description of the property itself.

Glossary

Before you read on, let's just refresh the meaning of a few concepts mentioned on the next pages:

TCE
Short for TYPO3 Core Engine. Also referred to as "DataHandler". The corresponding class \TYPO3\CMS\Core\DataHandling\DataHandler should ideally handle all updates to records made in the backend of TYPO3. The class will handle all the rules which may be applied to each table correctly. It will also handle logging, versioning, history and undo features, and copying, moving, deleting etc.
"list of"
Typically used like "list of field names". Whenever "list of" is used it means a list of strings separated by comma and with NO space between the values.
field name
The name of a field from a database table. Another word for the same is "column" but it is used more rarely, however the meaning is exactly the same.
record type
A record can have different types, determined by the value of a certain field in the record. This field is defined by the type property of the [ctrl] section. It affects which fields are displayed in backend form (see the "types" configuration). The record type can be considered as a switch in the interpretation of the whole record.
LLL reference
A localized string fetched from a locallang file by prefixing the string with LLL:.

About the examples

Extension styleguide

Many of the examples are part of the TYPO3 extension styleguide. This extension offers numbered examples for any field type. Furthermore there are examples with different properties set to different values.

Read here about how to install and use the styleguide extension.

Extension examples

Some examples can also be found in the TYPO3 extension examples. This extension contains special configurations that have not been used in the extension stylguide nor in the TYPO3 Core.

The extension examples can be installed via composer:

composer require --dev t3docs/examples
Copied!

It can also be downloaded from the TYPO3 extension repository.

Examples from the TYPO3 Core

Some examples are taken from the TYPO3 Core and some come from different system extensions. You can open their TCA definitions in the corresponding file in the system extension.

Common examples are taken from the following tables:

pages
public/typo3/sysext/core/Configuration/TCA/pages.php
sys_category
public/typo3/sysext/core/Configuration/TCA/sys_category.php
sys_file
public/typo3/sysext/core/Configuration/TCA/sys_file.php
sys_template
public/typo3/sysext/frontend/Configuration/TCA/sys_template.php
tt_content
public/typo3/sysext/frontend/Configuration/TCA/tt_content.php

How to use the styleguide extension

  1. Install the extension styleguide

    In composer based installations it can be installed via

    composer require --dev typo3/cms-styleguide
    Copied!

    For manual installations you can download the extension styleguide from GitHub.

  2. Create a page tree with the examples

    Go to the Help menu (?) > Styleguide. In the styleguide choose tab TCA / Records and then the button Create styleguide page tree with data. After you are done you can delete the example page tree by clicking the other button Delete styleguide page tree and all styleguide data records

  3. Have a look at the examples

    Navigate to the new page tree called styleguide TCA demo, using the List module. Choose a page, for example elements basic, and open the English record. The records in the other languages can be used to see examples of localization and the relation between languages.

  4. Find the corresponding TCA definition

    All TCA examples are called after their type and then numbered. The tables carry the same name as the entry in the page tree, prefixed with tx_styleguide_ therefore you would find the examples from elements_basic at: public/typo3conf/ext/styleguide/Configuration/TCA/tx_styleguide_elements_basic.php.

    Open the file with an editor of your choice. Then search for the name of the field, in this example checkbox_9. You can then have a look at the TCA definition in a working example.

    some image

    The corresponding code

Best practices

Some configuration settings are applied to almost all tables in TYPO3. See the following sections about best practises and conventions.

Common fields

Mandatory fields

If the table has a TCA definition, TYPO3 will automatically create the following fields:

uid
An auto-incrementing unique identifier. This field is used as table key and as a reference in relationships between records.
pid
The uid field of the parent page. The record is situated on this page. If this value is 0 the record is not connected to any page.

There is no separate TCA definition of these fields in the TCA configuration. It is not possible to use other names for these fields.

Fields used by convention

Soft delete

deleted

This field is used to enable soft delete in records. In can be configured by setting ctrl->delete:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'delete' => 'deleted',
        // ...
    ],
];
Copied!

The deleted field is never directly visible in backend forms. It is handled separately by the DataHandler. Therefore it needs no definition in the columns section.

Enablecolumns

Changed in version 13.3

hidden

This field is used to enable soft hiding of records. In can be configured by setting ctrl->enablecolumns->disabled:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        // ...
    ],
    'palettes' => [
        'visibility' => [
            'showitem' => 'hidden',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;visibility,
            ',
        ],
    ],
];
Copied!
starttime and endtime

This field is used to enable records by a starttime and or disable them with an endtime. In can be configured by ctrl->enablecolumns->starttime or endtime:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        // ...
    ],
    'palettes' => [
        'access' => [
            'showitem' => 'starttime, endtime',
        ],
        'visibility' => [
            'showitem' => 'hidden',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;visibility,
                    --palette--;;access,
            ',
        ],
    ],
];
Copied!
fe_group

This field is used to enable soft delete of records. In can be configured by ctrl->enablecolumns->fe_group:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'fe_group' => 'fe_group',
        ],
        // ...
    ],
    'palettes' => [
        'access' => [
            'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access',
            'showitem' => '
                fe_group,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;access,
            ',
        ],
    ],
];
Copied!

Manual sorting in the backend

sorting

This field is used to manually sort records in the backend. In can be configured by ctrl->sortby:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'sortby' => 'sorting',
    ],
];
Copied!

Fields managed by the DataHandler

The following fields are automatically set when a record is written by the DataHandler. They should never be displayed in backend forms or explicitly set, therefore they need no entry in the Field definitions (columns) section of the TCA.

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'origUid' => 't3_origuid',
        // ...
    ],
];
Copied!
tstamp

This field is automatically updated to the current timestamp each time the record is updated or saved in the DataHandler.

It can be configured by setting ctrl->tstamp.

crdate

This field is automatically set to the current timestamp if the record is created by the DataHandler.

It can be configured by setting ctrl->crdate.

t3_origuid

Field name, which contains the uid of the original record in case a record is created as a copy or new version of another record.

It can be configured by setting ctrl->origUid.

Language fields

Changed in version 13.3

The column definitions for these settings are auto-created. See also .

See also the Frontend Localization Guide.

All columns mentioned below get auto-created in the TCA and added to the database automatically. It is not recommended to define them in the TCA overrides or ext_tables.sql. Doing so with incompatible settings can lead to problems later on.

Language fields in detail

sys_language_uid

This field gets defined in ctrl->languageField. If this field is defined a record in this table can be translated into another language.

A typical sys_language_uid field
l10n_parent

This field gets defined in ctrl->transOrigPointerField.

If this value is found being set together with languageField then FormEngine will show the default translation value under the fields in the main form.

Header field showing values from two other languages

Header field showing values from two other languages

l10n_source

This field gets defined in ctrl->translationSource.

This field contains the uid of the record the translation was created from. For example if your default language is English and you already translated a record into German you can base the Suisse-German translation on the German record. In this case l10n_parent would contain the uid of the English record while l10n_source contains the uid of the German record.

l10n_diffsource

This field gets defined in ctrl->transOrigPointerField.

This information is used later on to compare the current values of the default record with those stored in this field. If they differ, there will be a display in the form of the difference visually:

Example: Enable table for localization and translation:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'palettes' => [
        'language' => [
            'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
            ',
        ],
    ],
];
Copied!

Field definitions (columns)

The ['columns'] section contains configuration for each table field (also called "column") which can be edited or shown in the backend. This is typically the biggest part of a TCA definition.

The configuration includes both properties for the display in the backend as well as the processing of the submitted data.

Each field can be configured as a certain "type" (required!), for instance a checkbox, an input field, or a database relation selector box. Each type allows a set of additional "renderType"s (sometimes required!). Each "type" and "renderType" combination comes with a set of additional properties.

Content on this page

Example: A basic input field

The basic structure of a field definition in TCA looks like this:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'input_1' => [
            'l10n_mode' => 'prefixLangTitle',
            'label' => 'input_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'input',
                'behaviour' => [
                    'allowLanguageSynchronization' => true,
                ],
            ],
        ],
    ],
]
Copied!

You can find this example in the extension styleguide.

Properties on the level parallel to label are valid for all "type" and "renderType" combinations. They are listed below. The list of properties within the "config" section depend on the specific "type" and "renderType" combination and are explained in detail in the ['columns']['config'] section.

Properties of columns section of TCA

Name Type Scope
array Proc. / Display
string, one of the column types
string
string or LLL reference Display
string / array Display
boolean Proc. / Display
string (list of keywords) Display
string (keyword) Display / Proc.
string or LLL reference Display
string Display

config

config
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Required
true
Scope
Proc. / Display
Example
Example: A basic input field

Contains the main configuration properties of the fields display and processing behavior.

The possibilities for this array depend on the value of the array keys type and rendertype within the array.

type

type
Type
string, one of the column types
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['type']
Required
true

The type influences the rendering of the form field in the backend. It also influences the processing of data on saving the values.

rendertype

rendertype
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['rendertype']
Required
true

For some type definitions there are additional render types available that mainly influence rendering. For example Select fields and Text areas provide different render types.

description

description
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Display
Example
Example: A basic input field

The property can be used to display an additional help text between the field label and the user input when editing records. As an example, the Core uses the description property in the site configuration module when editing a site on some properties like identifier.

The property is available on all common TCA types like input and select and so on.

The field can be used with a string that will be directly output or with a language reference.

displayCond

displayCond
Type
string / array
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Display
Example
Examples for display conditions

Contains one or more condition rules for whether to display the field or not.

Read more in the dedicated chapter Display conditions in TCA columns.

exclude

exclude
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Proc. / Display

If set, all backend users are prevented from editing the field unless they are members of a backend user group with this field added as an "Allowed Excludefield" (or "admin" user).

See Access lists for more about permissions.

Example: Simple input field
[
     'columns' => [
          'input_2' => [
                'label' => 'input_2 description',
                'exclude' => true,
                'config' => [
                     'type' => 'input',

                ],
          ],
     ],
]
Copied!

l10n_display

l10n_display
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Display
Example
Select field with defaultAsReadonly, Translated field without l10n_display definition

Localization display, see l10n_mode.

This option can be used to define the language related field rendering. This has nothing to do with the processing of language overlays and data storage but the display of form fields.

Keywords are:

hideDiff
The differences to the default language field will not be displayed.
defaultAsReadonly
This renders the field as read only field with the content of the default language record. The field will be rendered even if l10n_mode is set to 'exclude'. While exclude defines the field not to be translatable, this option activates the display of the default data.

l10n_mode

l10n_mode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Display / Proc.
Example
Example: prefixLangTitle, Disable the prefixLangTitle for the header field in tt_content

Only active if the ['ctrl']['languageField'] property is set.

The main relevance is when a record is localized by an API call in DataHandler that makes a copy of the default language record. You can think of this process as copying all fields from the source record. By default, the given value from the default language record is copied to the localization overlay and the field is editable in the overlay record. This behaviour can be changed:

exclude
Field will not be shown in FormEngine if this record is a localization of the default language. Works basically like a display condition. Internally, the field value of the default language record is copied over to the field of the localized record. The DataHandler keeps the values of localized records in sync and actively copies a changed value from the default language record into the localized overlays if changed. You can force the field to be displayed as readonly (with default language value) by setting "l10n_display" to defaultAsReadonly.
prefixLangTitle
The field value from the default language record gets copied when a localization overlay is created, but the content is prefixed with the title of the target language. The field stays editable in the localized record. It only works for field types like "text" and "input". The text will be prepended and can be configured by the page TSconfig property TCEMAIN.translateToMessage

If this property is not set for a given field, the value of the default language record is copied over to the localized record on creation, the field value is then distinct from the default language record, can be edited at will and will never be overwritten by the DataHandler if the value of the default language record changes.

label

label
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
true
Scope
Display
Example
Example: A basic input field

The name of the field as shown in the form:

onChange

onChange
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]
Required
false
Scope
Display

If set to reload, it triggers a form reload once the value of this field is changed. This is automatically set for fields specified as record type in the control section.

The onChange property is useful for fields which are targets of a display condition's FIELD: evaluation.

On changing the field a modal gets displayed prompting to reload the record.

Example: Select field triggering reload
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_requestUpdate_1' => [
            'label' => 'select_requestUpdate_1',
            'onChange' => 'reload',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Just an item',
                        'value' => 1,
                    ],
                    [
                        'label' => 'bar',
                        'value' => 'bar',
                    ],
                    [
                        'label' => 'and yet another one',
                        'value' => -1,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Display conditions in TCA columns

Display conditions ($GLOBALS['TCA'][$table]['columns'][$field][displayCond]) can be used to only display the affected field if certain other fields are set to certain values.

Conditions can be grouped and nested using boolean operators AND or OR as array keys. See examples below.

Rules in display conditions

A rule is a string divided into several parts by ":" (colons). The first part is the rule-type and the subsequent parts depend on the rule type.

The following rules are available:

FIELD

This evaluates based on another field's value in the record.

  • Part 1 is the field name
  • Part 2 is the evaluation type. These are the possible options:

    REQ
    Requires the field to have a "true" value. False values are "" (blank string) and 0 (zero). Everything else is true. For the REQ evaluation type Part 3 of the rules string must be the string "true" or "false". If "true" then the rule returns "true" if the evaluation is true. If "false" then the rule returns "true" if the evaluation is false.
    > / < / >= / <=
    Evaluates if the field value is greater than, less than the value in "Part 3"
    = / !=
    Evaluates if the field value is equal to value in "Part 3"
    IN / !IN
    Evaluates if the field value is in the comma list equal to value in "Part 3"
    - / !-
    Evaluates if the field value is in the range specified by value in "Part 3" ([min] - [max])
    BIT / !BIT
    Evaluates if the bit specified by the value in "Part 3" is set in the field's value (considered as an integer)
  • Part 3 is a comma separated list of string or numeric values
REC:NEW:true
This will show the field for new records which have not been saved yet.
REC:NEW:false
This will show the field for existing records which have already been saved.
HIDE_FOR_NON_ADMINS
This will hide the field for all non-admin users while admins can see it. Useful for FlexForm container fields which are not supposed to be edited directly via the FlexForm but rather through some other interface.
USER

userFunc call with a fully qualified class name.

Additional parameters can be passed separated by colon: USER:Evoweb\\Example\\User\\MyConditionMatcher->checkHeader:some:more:info

The following arguments are passed as array to the userFunc:

  • record: the currently edited record
  • flexContext: details about the FlexForm if the condition is used in one
  • flexformValueKey: vDEF
  • conditionParameters: additional parameters

The called method is expected to return a bool value: true if the field should be displayed, false otherwise.

VERSION:IS

Evaluate if a record is a "versioned" record from workspaces.

  • Part 1 is the type:

    IS
    Part 2 is "true" or "false": If true, the field is shown only if the record is a version (pid == -1). Example to show a field in "Live" workspace only: VERSION:IS:false

In FlexForm, display conditions can be attached to single fields in sheets, to sheets itself, to flex section fields and to flex section container element fields. FIELD references can be prefixed with a sheet name to reference a field from a neighbor sheet, see examples below.

Examples for display conditions

Basic display condition

This example will require the field named "tx_templavoila_ds" to be true, otherwise the field for which this rule is set will not be displayed:

'displayCond' => 'FIELD:tx_templavoila_ds:REQ:true',
Copied!

Combining conditions

Multiple conditions can be combined:

'displayCond' => [
    'AND' => [
        'FIELD:tx_templavoila_ds:REQ:true',
        'FIELD:header:=:Headline',
    ],
],
Copied!

An example with multiple values and OR:

EXT:my_extension/Configuration/TCA/Overrides/tx_mask_field.php
$GLOBALS['TCA']['tx_mask_table']['columns']['tx_mask_field']['displayCond']['OR'] = [
    'FIELD:tx_mask_otherfield:=:1',
    'FIELD:tx_mask_otherfield:=:2',
    'FIELD:tx_mask_otherfield:=:4',
];
Copied!

This is the same as:

EXT:my_extension/Configuration/TCA/Overrides/tx_mask_field.php
      $GLOBALS['TCA']['tx_mask_table']['columns']['tx_mask_field']['displayCond']
= 'FIELD:tx_mask_otherfield:IN:1,2,4';
Copied!

A complex example

Going further the next example defines the following conditions: for the "example_field" field to be displayed, the content element must be in the default language. Furthermore it must be a text-type element or have the headline "Example" defined:

'displayCond' => [
    'AND' => [
        'FIELD:sys_language_uid:=:0',
        'OR' => [
            'FIELD:CType:=:text',
            'FIELD:header:=:Example'
        ]
    ]
],
Copied!

A complex example in a FlexForm

Using OR and AND within FlexForms works like this:

<displayCond>
    <and>
        <value1>FIELD:sys_language_uid:=:0</value1>
        <or>
            <value1>FIELD:CType:=:text</value1>
            <value2>FIELD:header:=:Example</value2>
        </or>
    </and>
</displayCond>
Copied!

Access values in a flexform

Flex form fields can access field values from various different sources:

<!-- Hide field if value of record field "header" is not "true" -->
<displayCond>FIELD:parentRec.header:REQ:true</displayCond>
<!-- Hide field if value of parent record field "field_1" is not "foo" -->
<displayCond>FIELD:parentRec.field_1:!=:foo</displayCond>
<!-- Hide field if value of neighbour field "flexField_1 on same sheet is not "foo" -->
<displayCond>FIELD:flexField_1:!=:foo</displayCond>
<!-- Hide field if value of field "flexField_1" from sheet "sheet_1" is not "foo" -->
<displayCond>FIELD:sheet_1.flexField_1:!=:foo</displayCond>
Copied!

Technical background

The display conditions are implemented in class \TYPO3\CMS\Backend\Form\FormDataProvider\EvaluateDisplayConditions , which is a FormDataProvider. It can be used for fields directly in the record as well as for FlexForm values.

Examples

Some examples from extension styleguide to get an idea on what the field definition is capable of: An input field with slider, a select drop-down for images, an inline relation spanning multiple tables.

The following examples all can be found in the extension styleguide.

Select drop-down for records represented by images

Select field with foreign table relation and field wizard:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

The table tx_styleguide_elements_select_single_12_foreign is defined as follows:

[
   'ctrl' => [
      'title' => 'Form engine elements - select foreign single_12',
      'label' => 'fal_1',
      'selicon_field' => 'fal_1',
      // ...
   ],

   'columns' => [
      // ...
      'fal_1' => [
         'label' => 'fal_1 selicon_field',
         'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
            'fal_1',
            [
               'maxitems' => 1,
            ],
            $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']
         ),
      ],
   ],
   // ...

];
Copied!

Inline relation (IRRE) spanning multiple tables

Inline relation to a foreign table:

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_1n1n.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_1n1n_child',
                'foreign_field' => 'parentid',
                'foreign_table_field' => 'parenttable',
            ],
        ],
    ],
]
Copied!

Example: prefixLangTitle

The following example can be found in the extension styleguide. On translating a record in a new language the content of the field gets copied to the target language. It get prefixed with [Translate to <language name>:].

The language mode is defined as follows:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_2' => [
            'l10n_mode' => 'prefixLangTitle',
            'label' => 'text_2',
            'description' => 'cols=20',
            'config' => [
                'type' => 'text',
                'cols' => 20,
            ],
        ],
    ],
]
Copied!

Disable the prefixLangTitle for the header field in tt_content

Use the default behaviour instead of prefixLangTitle: the field will be copied without a prepended string.

EXT:my_sitepackage/Configuration/TCA/Overrides/tt_content.php
$GLOBALS['TCA']['tt_content']['columns']['header']['l10n_mode'] = ''
Copied!

Select field with defaultAsReadonly

The following field has the option 'l10n_display' => 'defaultAsReadonly' set:

Complete TCA definition of the field:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_13' => [
            'label' => 'select_single_13 l10n_display=defaultAsReadonly',
            'l10n_mode' => 'exclude',
            'l10n_display' => 'defaultAsReadonly',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'foo',
                        'value' => 'foo',
                    ],
                    [
                        'label' => 'bar',
                        'value' => 'bar',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Translated field without l10n_display definition

The following has no 'l10n_display' definition:

Complete TCA definition of the field:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_8' => [
            'label' => 'select_single_8 drop down with empty div',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'First div with items',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'item 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'Second div without items',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'Third div with items',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Field types (config > type)

The field types get defined in the TCA of a field in ['config']['type']. The field type influences the rendering of the form field in the backend. It also influences the processing of data on saving the values. Those behaviour can be influenced by further properties.

Section ['columns'][*]['config'] (where * stands for a table column) is the main workhorse when it comes to single field configuration. The main property is type, it specifies the DataHandler processing and database value. Additionally, property renderType specifies how a field is rendered. The renderType is sometimes optional. Both properties together specify the set of properties that are valid for one field.

This section of the documentation is first split by type to give an overview of what can be done with a type, then lists all possible renderType's with all possible properties. Since some type's can do useful stuff without a specific renderType too, those properties are listed below renderType "default", which equals to "not set".

An overview of available types:

check

One or multiple check boxes

flex
Form elements stored in an XML structure in one field.
group

Relations to other table rows or files.

imageManipulation
Json array with cut / cropping information. Special field for images in FAL / Resource handling.
inline

Relations to other table rows that can be edited in the same form. Also used for file resources via sys_file_reference table.

input

Single line text input. Used for a various different single line outputs like head lines, links, color pickers.

none

Read only, virtual field. No DataHandler processing.

passthrough
Not displayed, only send as hidden field to DataHandler.
radio

One or multiple radio buttons.

select

Select one or more items from a list.

slug
Define parts of a URL path
text

A multiline text field. Used for RTE display, code editor and some more.

user
Special rendering and evaluation defined by an additional node in the form engine

Properties in depth

The following TCA properties need some in-depth description. They work basically the same no matter which of the allowed field types they are used in.

fieldInformation

fieldInformation

fieldInformation
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
check, flex, group, imageManipulation, input, none, radio

Show information between an element label and the main element input area. Configuration works identical to the "fieldWizard" property, no default configuration in the core exists (yet). In contrast to "fieldWizard", HTML returned by fieldInformation is limited, see FormEngine docs for more details.

Example

You can have a look at the extension georgringer/news in version 9.4 for an example: https://github.com/georgringer/news/blob/9.4.0/Configuration/TCA/tx_news_domain_model_news.php#L521 (with georgringer/news ^10.0 this was moved to a non-public extension).

EXT:news/Configuration/TCA/tx_news_domain_model_news.php (Excerpt)
'tags' => [
    'config' => [
        // ...
        'fieldInformation' => [
            'tagInformation' => [
                'renderType' => 'NewsStaticText',
                'options' => [
                    'labels' => [
                        [
                            'label' => '',
                            'bold' => true,
                            'italic' => true,
                        ],
                    ],
                ],
            ],
        ],
    ]
Copied!

The implementation can be found in https://github.com/georgringer/news/blob/9.4.0/Classes/Backend/FieldInformation/StaticText.php:

<?php

declare(strict_types=1);

namespace GeorgRinger\News\Backend\FieldInformation;

use TYPO3\CMS\Backend\Form\AbstractNode;

class StaticText extends AbstractNode
{
    public function render(): array
    {
        // ...

        return [
            'requireJsModules' => [
                'TYPO3/CMS/News/TagSuggestWizard',
            ],
            'html' => '...>',
        ];
    }
}
Copied!

The custom FieldInformation must be rendered in ext_localconf.php:

EXT:news/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1552726986] = [
    'nodeName' => 'NewsStaticText',
    'priority' => 70,
    'class' => \GeorgRinger\News\Backend\FieldInformation\StaticText::class
];
Copied!

itemsProcFunc

itemsProcFunc

itemsProcFunc
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']

type

string (class->method reference)

Scope

Display / Proc.

Types

check, select, radio

PHP method which is called to fill or manipulate the items array. It is recommended to use the actual FQCN with class and then concatenate the method:

\VENDOR\Extension\UserFunction\FormEngine\YourClass::class . '->yourMethod'

This becomes handy when using an IDE and doing operations like renaming classes.

The provided method will have an array of parameters passed to it. The items array is passed by reference in the key items. By modifying the array of items, you alter the list of items. A method may throw an exception which will be displayed as a proper error message to the user.

Passed parameters

  • items (passed by reference)
  • config (TCA config of the field)
  • TSconfig (The matching itemsProcFunc TSconfig)
  • table (current table)
  • row (current database record)
  • field (current field name)
  • effectivePid (correct page ID)
  • site (current site)

The following parameter only exists if the field has a flex parent.

  • flexParentDatabaseRow

The following parameters are filled if the current record has an inline parent.

  • inlineParentUid
  • inlineParentTableName
  • inlineParentFieldName
  • inlineParentConfig
  • inlineTopMostParentUid
  • inlineTopMostParentTableName
  • inlineTopMostParentFieldName

Example

The configuration for a custom field select_single_2 could look like this:

'select_single_2' => [
    'exclude' => 1,
    'label' => 'select_single_2 itemsProcFunc',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
            ['label' => 'foo', 'value' => 1],
            ['label' => 'bar', 'value' => 'bar'],
        ],
        'itemsProcFunc' => TYPO3\CMS\Styleguide\UserFunctions\FormEngine\TypeSelect2ItemsProcFunc::class . '->itemsProcFunc',
    ],
]
Copied!

The referenced itemsProcFunc method should populate the items by filling $params['items']:

/**
 * A user function used in select_2
 */
class TypeSelect2ItemsProcFunc
{
    /**
     * Add two items to existing ones
     *
     * @param array $params
     */
    public function itemsProcFunc(&$params): void
    {
        $params['items'][] = ['label' => 'item 1 from itemProcFunc()', 'value' => 'val1'];
        $params['items'][] = ['label' => 'item 2 from itemProcFunc()', 'value' => 'val2'];
    }
}
Copied!

This results in the rendered select dropdown having four items. This is a really simple example. In the real world you would use the other passed parameters to dynamically generate the items.

MM

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
group, select, inline

The relation of the records of the specified table gets stored in an intermediate table. The name of this table is stored in the property MM.

This property is used with foreign_table (select) for select fields, allowed (group) for group fields or foreign_table (inline) for inline fields.

The table defined in this property is automatically created by the Database Analyzer.

The field for which an MM configuration exists stores the number of records in the relation on each update, so the field should be an integer.

MM relations and FlexForms

MM relations has been tested to work with FlexForms if not in a repeated element in a section.

Auto creation of intermediate MM tables from TCA

TCA table column fields that define ['config']['MM'] can drop specification of the intermediate mm table layout in: ext_tables.sql. The TYPO3 database analyzer takes care of proper schema definition.

Extensions are strongly encouraged to drop ext_tables.sql CREATE TABLE definitions for those intermediate tables referenced by TCA table columns. Dropping these definitions allows the Core to adapt and migrate definitions if needed.

The mm tables are automatically created if:

  • A table column TCA config defines MM with type='select', type='group' or type='inline'.
  • The "MM" intermediate table has no TCA table definition (!).
  • A table of the resulting name is not defined in ext_tables.sql.

The schema analyzer takes care of further possible fields apart from uid_local and uid_foreign, like tablenames, fieldname and uid if necessary, depending on local side of the TCA definition.

The fields used for sorting sorting and sorting_foreign are always created, they do not need to be defined in TCA.

Example

The "local" side of a mm table is defined as such in TCA:

...
'columns' => [
    ...
    'myField' => [
        'label' => 'myField',
        'config' => [
            'type' => 'group',
            'foreign_table' => 'tx_myextension_myfield_child',
            'MM' => 'tx_myextension_myfield_mm',
        ]
    ],
    ...
],
...
Copied!

A table like the following will be automatically created in the Database Analyzer:

CREATE TABLE tx_myextension_myfield_mm (
    uid_local int(11) DEFAULT '0' NOT NULL,
    uid_foreign int(11) DEFAULT '0' NOT NULL,
    sorting int(11) DEFAULT '0' NOT NULL,
    sorting_foreign int(11) DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);
Copied!

Columns of the intermediate MM table

The intermediate table may have the following fields:

uid_local, uid_foreign
Storing uids of both sides. If done right, this is reflected in the table name - tx_foo_local_foreign_mm
sorting, sorting_foreign
Are required fields used for ordering the items.
tablenames
Is used if multiple tables are allowed in the relation.
uid (auto-incremented and PRIMARY KEY)
May be used if you need the "multiple" feature (which allows the same record to be references multiple times in the box. See MM_hasUidField for type='group' fields.
further fields
May exist, in particular if MM_match_fields / MM_match_fields is involved in the set up.

fieldControl

fieldControl

fieldControl
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
group, imageManipulation, input, radio

Show action buttons next to the element. This is used in various type's to add control buttons right next to the main element. They can open popups, switch the entire view and other things. All must provide a "button" icon to click on, see FormEngine docs for more details. See type=group for examples.

addRecord

addRecord

addRecord
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

Control button to directly add a related record. Leaves the current view and opens a new form to add a new record. On 'Save and close', the record is directly selected as referenced element in the type='group' field. If multiple tables are allowed, the first table from the allowed list is selected, if no specific table option is given.

Examples

Select field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_6' => [
            'label' => 'select_multiplesidebyside_6 fieldControl',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'size' => 5,
                'autoSizeMax' => 20,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Group field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Select field with options

The field controls are also used in the core. The following example is from the table be_groups:

EXT:core/Configuration/TCA/be_groups.php
[
    'columns' => [
        'file_mountpoints' => [
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'sys_filemounts',
                'foreign_table_where' => ' AND {#sys_filemounts}.{#pid}=0',
                'size' => 3,
                'autoSizeMax' => 10,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_edit_title',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_add_title',
                            'setValue' => 'prepend',
                        ],
                    ],
                    'listModule' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_list_title',
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Options

disabled

disabled
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']
Scope
fieldControl -> addRecord
Default
true

Disables the field control. Needs to be set to false to enable the Create new button

options[pid]

options[pid]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']
Scope
fieldControl -> addRecord
Values
marker or an integer
Default
###CURRENT_PID###

pid of the new record. Can be an hard pid setting, or one of these markers, see select foreign_table_where.

Falls back to "current pid" if not set, forces pid=0 if records of this table are only allowed on root level.

  • ###CURRENT_PID###
  • ###THIS_UID###
  • ###SITEROOT###

options[table]

options[table]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']
Scope
fieldControl -> addRecord
Values
name of the table
Default
First table from property allowed / foreign_table

Add a record to this table, falls back to first table from allowed list if not set for type='group' fields and to foreign_table for type='select' fields.

options[title]

options[title]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']
Scope
fieldControl -> addRecord
Values
string or LLL reference
Default
LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.createNew

Allows to set a different 'title' attribute to the popup icon.

options[setValue]

options[setValue]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']
Scope
fieldControl -> addRecord
Values
string
Default
append

Can be one of 'set', 'prepend' or 'append'. With 'set' the given selection is substituted with the new record, 'prepend' adds the new record on top of the list, 'append' adds it at the bottom.

editPopup

editPopup

editPopup
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

The edit popup field control shows a pencil icon to edit an element directly in a popup window. When a record is selected and the edit button is clicked, that record opens in a new window for modification.

Options

disabled

disabled
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']
Scope
fieldControl -> editPopup
Default
true

Disables the field control. Needs to be set to false to enable the Create new button

options[title]

options[title]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']
Scope
fieldControl -> editPopup
Values
string or LLL reference
Default
LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit

Allows to set a different 'title' attribute to the popup icon.

options[windowOpenParameters]

options[windowOpenParameters]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']
Scope
fieldControl -> editPopup
Values
string or LLL reference
Default
height=800,width=600,status=0,menubar=0,scrollbars=1

Allows to set a different size of the popup, defaults

Examples

Select field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_6' => [
            'label' => 'select_multiplesidebyside_6 fieldControl',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'size' => 5,
                'autoSizeMax' => 20,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Group field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

listModule

listModule

listModule
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

The list module control button opens the Web > List module for only one table and allows the user to manipulate stuff there.

Options

disabled

disabled
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['listModule']
Scope
fieldControl -> listModule
Default
true

Disables the field control. Needs to be set to false to enable the Create new button

options[pid]

options[pid]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['listModule']
Scope
fieldControl -> addRecord
Values
marker or an integer
Default
###CURRENT_PID###

List records from this pid. Can be an hard pid setting, or one of these markers, see select foreign_table_where.

Falls back to "current pid" if not set, forces pid=0 if records of this table are only allowed on root level.

  • ###CURRENT_PID###
  • ###THIS_UID###
  • ###SITEROOT###

listModule options[table]

listModule options[table]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['listModule']
Scope
fieldControl -> listModule
Values
name of the table
Default
First table from property allowed / foreign_table

List records of this table only, falls back to first table from allowed list if not set for type='group' fields and to foreign_table for type='select' fields.

options[title]

options[title]
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['listModule']
Scope
fieldControl -> listModule
Values
string or LLL reference
Default
LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.list

Allows to set a different 'title' attribute to the popup icon.

Examples

Select field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_6' => [
            'label' => 'select_multiplesidebyside_6 fieldControl',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'size' => 5,
                'autoSizeMax' => 20,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Group field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

resetSelection

resetSelection

resetSelection
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
Description

Render a button next to the select box to reset a changed selection to the state before it was manipulated by the user.

fieldWizard

fieldWizard

fieldWizard
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
check, flex, group, imageManipulation, input, radio

Specifies wizards rendered below the main input area of an element. Single type / renderType elements can register default wizards which are merged with this property.

For example, type='check' comes with this default wizards configuration:

protected $defaultFieldWizard = [
    'localizationStateSelector' => [
        'renderType' => 'localizationStateSelector',
    ],
    'otherLanguageContent' => [
        'renderType' => 'otherLanguageContent',
        'after' => [
            'localizationStateSelector'
        ],
    ],
    'defaultLanguageDifferences' => [
        'renderType' => 'defaultLanguageDifferences',
        'after' => [
            'otherLanguageContent',
        ],
    ],
];
Copied!

This is be merged with the configuration from TCA, if there is any. Below example disables the default localizationStateSelector wizard.

'aField' => [
    'config' => [
        'fieldWizard' => [
            'localizationStateSelector' => [
                'disabled' => true,
            ],
        ],
    ],
],
Copied!

It is possible to add own wizards by adding them to the TCA of the according field and pointing to a registered renderType, to resort wizards by overriding the before and after keys, to hand over additional options in the optional options array to specific wizards, and to disable single wizards using the disabled key. Developers should have a look at the FormEngine docs for details.

defaultLanguageDifferences

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']
Scope
fieldWizard
Types
check, flex, group, imageManipulation, input, radio

Show a "diff-view" if the content of the default language record has been changed after the translation overlay has been created. The ['ctrl'] section property transOrigDiffSourceField has to be specified to enable this wizard in a translated record.

This wizard is important for editors who maintain translated records: They can see what has been changed in their localization parent between the last save operation of the overlay.

A field has been changed in default language record

A field has been changed in default language record

localizationStateSelector

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']
Scope
fieldWizard
Types

check, flex, group, imageManipulation, input

The localization state selector wizard displays two or three radio buttons in localized records saying: "This field has an own value distinct from my default language or source record", "This field has the same value as the default language record" or "This field has the same value as my source record". This wizard is especially useful for the tt_content table. It will only render, if:

  • The record is a localized record (not default language)
  • The record is in "translated" (connected), but not in "copy" (free) mode
  • The table is localization aware using the ['ctrl'] properties languageField, transOrigPointerField. If the optional property translationSource is also set, and if the record is a translation from another localized record, the third radio appears.
  • The property ['config']['behaviour']['allowLanguageSynchronization'] is set to true
Example localization state selector on a type=input field

Example localization state selector on an type=input field

otherLanguageContent

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']
Scope
fieldWizard
Types
check, flex, group, imageManipulation, input, radio

Show values from the default language record and other localized records if the edited row is a localized record. Often used in tt_content fields. By default, only the value of the default language record is shown, values from further translations can be shown by setting the user TSconfig property additionalPreviewLanguages.

The wizard shows content only for "simple" fields. For instance, it does not work for database relation fields, and if the field is set to readOnly. Additionally, the table has to be language aware by setting up the according fields in ['ctrl'] section.

Header field showing values from two other languages

Header field showing values from two other languages

TCA column type category

While using the type category, TYPO3 takes care of generating the necessary TCA configuration. Developers only have to define the TCA column and add category as the desired TCA type in the tables's TCA file (inside or outside of the Overrides folder).

The according database field is generated automatically.

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

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

$GLOBALS['TCA'][$myTable]['columns']['categories'] = [
    'config' => [
        'type' => 'category',
    ],
];

ExtensionManagementUtility::addToAllTCAtypes(
    $myTable,
    'categories'
);
Copied!

The following options can be overridden via page TSconfig, TCE form:

  • size
  • maxitems
  • minitems
  • readOnly
  • treeConfig

Properties of the TCA column type category

Name Type Scope
string Display / Proc.
string (list of) Display / Proc.
string (table name) Proc. / Display
string (column name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
boolean Display
string Display / Proc.
integer Display
array Display

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, no category gets selected.

exclusiveKeys

exclusiveKeys
Type
string (list of)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

List of keys that exclude any other keys in a select box where multiple items could be selected. See also property exclusiveKeys of selectTree.

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma-separated list by default.

Use property MM <columns-category-properties-mm> to store the values in an intermediate MM table instead.

foreign_table_item_group

foreign_table_item_group
Type
string (column name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

New in version 13.0

This property references a specific field in the foreign table, which holds an item group identifier.

See also property foreign_table_item_group of select field.

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Label prefix to the title of the records from the foreign-table.

See also property foreign_table_prefix of select field.

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
Default
AND {#sys_category}.{#sys_language_uid} IN (-1, 0)

The items from foreign_table are selected with this WHERE clause. If set make sure to append the default value to your query. See also property foreign_table_where of select field.

itemGroups

itemGroups
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains an array of key-value pairs. The key contains the id of the item group, the value contains the label of the item group or its language reference.

Only groups containing items will be displayed. In the select field first all items with no group defined are listed then the item groups in the order of their definition, each group with the corresponding items.

See also property itemGroups of select field.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['maxitems']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['minitems']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description and the property MM of select field

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the values but cannot edit them. The rendering is as similar as possible to the normal rendering but may differ in layout and size.

relationship

relationship
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all
Default
manyToMany

All possible values are:

oneToOne
Stores the uid of the selected category. When using this relationship, maxitems=1 will automatically be added to the column configuration. While one record can only have a relation to one category, each category can still have a relationship to more then one record.
oneToMany
Stores the uids of selected categories in a comma-separated list.
manyToMany (default):
Uses the intermediate table sys_category_record_mm and only stores the categories count on the local side. This is the use case, which was previously accomplished using ExtensionManagementUtility->makeCategorizable().

In the following example a category tree is displayed, but only one category can be selected.

$GLOBALS['TCA'][$myTable]['columns']['mainCategory'] = [
    'config' => [
        'type' => 'category',
        'relationship' => 'oneToOne'
    ]
];
Copied!

All other relevant options, for example maxitems=1, are being set automatically.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['size']
Scope
Display

Maximal number of elements to be displayed by default

treeConfig

treeConfig
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
selectTree

Either childrenField or parentField has to be set - childrenField takes precedence. Keywords:

dataProvider
Allows to define a custom data provider class for usecases where special data preparation is necessary. By default \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider is used.
childrenField (string)
Field name of the foreign_table that references the uid of the child records.
parentField (string)
Field name of the foreign_table that references the uid of the parent record
startingPoints (string, comma separated values)

allows to set multiple records as roots for tree records.

The setting takes a CSV value, e.g. 2,3,4711, which takes records of the uids 2, 3 and 4711 into account and creates a tree of these records.

Additionally, each value used in startingPoints may be fed from a site configuration by using the ###SITE:### syntax.

Example:

# Site config
base: /
rootPageId: 1
categories:
    root: 123
Copied!
// Example TCA config
'config' => [
    'treeConfig' => [
        'startingPoints' => '1,2,###SITE:categories.root###',
    ],
],
Copied!

This will evaluate to 'startingPoints' => '1,2,123'.

appearance (array, optional)
showHeader (boolean)
Whether to show the header of the tree that contains a field to filter the records and allows to expand or collapse all nodes
expandAll (boolean)
Whether to show the tree with all nodes expanded
maxLevels (integer)
The maximal amount of levels to be rendered (can be used to stop possible recursions)
nonSelectableLevels (list, default "0")
Comma-separated list of levels that will not be selectable, by default the root node (which is "0") cannot be selected

Examples: TCA column type category

Simple category field

In the following example a category tree is displayed and multiple categories can be selected.

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

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

$GLOBALS['TCA'][$myTable]['columns']['categories'] = [
    'config' => [
        'type' => 'category',
    ],
];

ExtensionManagementUtility::addToAllTCAtypes(
    $myTable,
    'categories'
);
Copied!

The relationship gets stored in the intermediate table sys_category_record_mm. Category counts are only stored on the local side.

One to one relation category field

In the following example a category tree is displayed, but only one category can be selected.

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

$GLOBALS['TCA'][$myTable]['columns']['mainCategory'] = [
    'config' => [
        'type' => 'category',
        'relationship' => 'oneToOne',
    ],
];
Copied!

Category field used in FlexForm

It is possible to use the type category in FlexForm data structures. Due to some limitations in FlexForm, the manyToMany relationship is not supported. Therefore, the default relationship - used if none is defined - is oneToMany.

An example of the "oneToMany" use case is EXT:news, which allows to only display news of specific categories in the list view:

EXT:my_extension/Configuration/FlexForm/SomeFlexForm.xml
<T3DataStructure>
    <ROOT>
        <sheetTitle>aTitle</sheetTitle>
        <type>array</type>
        <el>
            <categories>
                <config>
                    <type>category</type>
                </config>
            </categories>
        </el>
    </ROOT>
</T3DataStructure>
Copied!

TCA column type check

New in version 13.0

Introduction

This type creates checkbox(es).

There can be between 1 and 31 checkboxes. The corresponding database field must be of type integer. Each checkbox corresponds to a single bit of the integer value, even if there is only one checkbox.

There is a subtle difference between fields of the type check and select fields with the render type selectCheckBox. For the details please see: selectCheckBox and type check fields compared.

The following renderTypes are available:

  • default: One or more checkboxes are displayed.
  • checkboxToggle: Instead of checkboxes, a toggle item is displayed.
  • checkboxLabeledToggle: A toggle switch where both states can be labelled (ON/OFF, Visible / Hidden or alike). Its state can be inverted via invertStateDisplay

Properties of the TCA column type check

Name Type Scope
boolean Proc.
integer/string Display
integer Display / Proc.
string (list of keywords) Proc. / Display
array
array
array
boolean Display
array Display
string (class->method reference) Display / Proc.
boolean Display
boolean Display
array Proc.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$jsonField = [
    'config' => [
        'type' => 'check',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

cols

cols
Type
integer/string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Examples
Example: Default checkboxes with fixed columns, Example: Checkboxes with Inline columns and default value

In how many columns the checkboxes will be shown. Makes sense only if the 'items' property is defining multiple checkboxes.

Allowed values are 1, 2, 3, ..., 31 or inline, 1 being default. If set to inline the checkboxes are "floating" and there will be as many in one row as fits to browser width.

Note checkboxes will still wrap if browser width is not sufficient.

Examples Fixes columns -------------

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_2' => [
            'label' => 'checkbox_2',
            'description' => 'one checkbox with label',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

default

default
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Examples
Example: Checkboxes with Inline columns and default value

The default value of the checkbox(es).

Each bit of the decimal value corresponds to a checkbox. As an example, the value 5 enables the first and third checkbox.

This is true even if there is only one checkbox, which then maps to the first bit (reading from right to left).

decimal value binary representation selected checkboxes
0 0000 0000 none
1 0000 0001 first
2 0000 0010 second
5 0000 0101 first, third
127 0111 1111 the first seven

To find out the right default decimal value, first start off by writing down the binary representation and set the desired bits at the appropriate position to 1. Then convert the binary number to decimal. You can either use a calculator with programmer mode or search online for "binary to decimal".

eval

eval
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
Example
Example: Checkbox limited to a maximal number of checked records

Configuration of field evaluation.

Keywords:

maximumRecordsChecked

If this evaluation is defined, the maximum number of records from the same table that can have this box checked will be limited. If someone tries to check the box of a record beyond the allowed maximum, the box will be unchecked automatically upon saving.

The actual limit is defined with the validation property validation.

maximumRecordsCheckedInPid
Similar to maximumRecordsChecked but with the validation scope limited to records stored in the same page.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

invertStateDisplay

invertStateDisplay
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
false
Example
Example: Toggle checkbox with invertStateDisplay

The state of a checkbox can be displayed inverted when this property is set to true.

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Example
Example: Three checkboxes, two with labels, one without

If set, this array will create an array of checkboxes instead of just a single "on/off" checkbox.

In this array each entry is itself an associative array. The value sent to the database will be an integer representing a bit mask based on the position of the checkbox in this array.

A basic item looks like this:

'items' => [
    ['label' => 'Green tomatoes'], // Note these should be LLL references
    ['label' => 'Red peppers'],
],
Copied!

Use the label key, instead of the numerical index 0 which was done in previous versions.

Further properties can be set per item, but not all of them apply to all renderTypes:

label (string or LLL reference)
The displayed title.
invertStateDisplay (boolean)
All renderTypes. If set to true, checked / unchecked state are swapped in view: A checkbox is marked checked if the database bit is not set and vice versa.
iconIdentifierChecked (string)
Only if renderType is not set (default): An optional icon shown is selected / on. If not set, a check mark icon is used.
iconIdentifierUnchecked (string)
Only if renderType is not set (default): An optional icon shown selected / on. If not set, no icon is show (check mark icon not displayed).
labelChecked (string)
Mandatory property for renderType checkboxLabeledToggle: Text shown if element is selected / on.
labelUnchecked (string)
Mandatory property for renderType checkboxLabeledToggle: Text shown if element is not selected.

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Example
Example: Checkboxes with itemsProcFunc

PHP method which is called to fill or manipulate the items array. It is recommended to use the actual FQCN with class and then concatenate the method:

\VENDOR\Extension\UserFunction\FormEngine\YourClass::class . '->yourMethod'

This becomes handy when using an IDE and doing operations like renaming classes.

The provided method will have an array of parameters passed to it. The items array is passed by reference in the key items. By modifying the array of items, you alter the list of items. A method may throw an exception which will be displayed as a proper error message to the user.

Passed parameters
  • items (passed by reference)
  • config (TCA config of the field)
  • TSconfig (The matching itemsProcFunc TSconfig)
  • table (current table)
  • row (current database record)
  • field (current field name)
  • effectivePid (correct page ID)
  • site (current site)

The following parameter only exists if the field has a flex parent.

  • flexParentDatabaseRow

The following parameters are filled if the current record has an inline parent.

  • inlineParentUid
  • inlineParentTableName
  • inlineParentFieldName
  • inlineParentConfig
  • inlineTopMostParentUid
  • inlineTopMostParentTableName
  • inlineTopMostParentFieldName

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders the field in a way that the user can see the values but cannot edit them. The rendering is as similar as possible to the normal rendering but may differ in layout and size.

renderType

renderType
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
check
Examples
default, checkboxToggle, checkboxLabeledToggle

Three different render types are currently available for the check box field:

validation

validation
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Example
Example: Only one record can be checked

Values for the eval rules. The keys of the array must correspond to the keyword of the related evaluation rule. For maximumRecordsChecked and maximumRecordsCheckedInPid the value is expected to be an integer.

Default checkbox

The checkbox with renderType check is typically a single checkbox or a group of checkboxes.

Its state can be inverted via invertStateDisplay.

Examples

All examples listed here can be found in the extension styleguide.

Example: Simple checkbox with label

TCA:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_2' => [
            'label' => 'checkbox_2',
            'description' => 'one checkbox with label',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

If the checkbox is checked, the value for the field will be 1, if unchecked, it will be 0.

FlexForm:

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
<checkbox_2>
   <label>checkbox_2 cols=3</label>
   <config>
       <type>check</type>
       <items type="array">
           <numIndex index="0" type="array">
               <label>foo1</label>
               <value></value>
           </numIndex>
           <numIndex index="1" type="array">
               <label>foo2</label>
               <value></value>
           </numIndex>
           <numIndex index="2" type="array">
               <label>foo3</label>
               <value></value>
           </numIndex>
           <numIndex index="3" type="array">
               <label>foo4</label>
               <value></value>
           </numIndex>
       </items>
       <cols>3</cols>
   </config>
</checkbox_2>
Copied!

Example: Four checkboxes in three columns

TCA:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_12' => [
            'label' => 'checkbox_12',
            'description' => 'cols=3',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo1',
                    ],
                    [
                        'label' => 'foo2',
                    ],
                    [
                        'label' => 'foo3',
                    ],
                    [
                        'label' => 'foo4',
                    ],
                ],
                'cols' => '3',
            ],
        ],
    ],
]
Copied!

If all checkboxes are checked, the value for the field will be 15 (1 | 2 | 4 | 8).

Example: Checkboxes with inline floating

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_16' => [
            'label' => 'checkbox_16',
            'description' => 'cols=inline',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'Mo',
                    ],
                    [
                        'label' => 'Tu',
                    ],
                    [
                        'label' => 'We',
                    ],
                    [
                        'label' => 'Th',
                    ],
                    [
                        'label' => 'Fr',
                    ],
                    [
                        'label' => 'Sa',
                    ],
                    [
                        'label' => 'Su',
                    ],
                ],
                'cols' => 'inline',
            ],
        ],
    ],
]
Copied!

This will display as many checkbox items as will fit in one row. Without inline, each checkbox would be displayed in a separate row.

Toggle checkbox

The checkbox with the renderType checkboxToggle renders as one or several toggle switches. As opposed to the Labeled toggle checkbox no additional labels for the states can be defined.

Its state can be inverted via invertStateDisplay.

Examples

Example: Single checkbox with toggle

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_17' => [
            'label' => 'checkbox_17',
            'description' => 'renderType=checkboxToggle single',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

checkboxToggle: Instead of checkboxes, a toggle item is displayed.

Example: Single checkbox with toggle inverted state display

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_18' => [
            'label' => 'checkbox_18',
            'description' => 'renderType=checkboxToggle single inverted state display',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        'label' => 'foo',
                        'invertStateDisplay' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

invertedStateDisplay: A checkbox is marked checked if the database bit is not set and vice versa.

Labeled toggle checkbox

The checkbox type with the renderType checkboxLabeledToggle is displayed as a toggle switch where both states can be labelled (ON / OFF, Visible / Hidden or alike).

Its state can be inverted via invertStateDisplay

Examples

Single checkbox with labeled toggle

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_19' => [
            'label' => 'checkbox_19',
            'description' => 'renderType=checkboxLabeledToggle single',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxLabeledToggle',
                'items' => [
                    [
                        'label' => 'foo',
                        'labelChecked' => 'Enabled',
                        'labelUnchecked' => 'Disabled',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Single checkbox with labeled toggle inverted state display

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_21' => [
            'label' => 'checkbox_21',
            'description' => 'renderType=checkboxLabeledToggle single inverted state display',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxLabeledToggle',
                'items' => [
                    [
                        'label' => 'foo',
                        'labelChecked' => 'Enabled',
                        'labelUnchecked' => 'Disabled',
                        'invertStateDisplay' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Examples

Example: Default checkboxes with fixed columns

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_2' => [
            'label' => 'checkbox_2',
            'description' => 'one checkbox with label',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Example: Checkboxes with Inline columns and default value

Here "Tu", the second bit, is active by default.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_16' => [
            'label' => 'checkbox_16',
            'description' => 'cols=inline',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'Mo',
                    ],
                    [
                        'label' => 'Tu',
                    ],
                    [
                        'label' => 'We',
                    ],
                    [
                        'label' => 'Th',
                    ],
                    [
                        'label' => 'Fr',
                    ],
                    [
                        'label' => 'Sa',
                    ],
                    [
                        'label' => 'Su',
                    ],
                ],
                'cols' => 'inline',
            ],
        ],
    ],
]
Copied!

Example: Checkbox limited to a maximal number of checked records

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_7' => [
            'label' => 'checkbox_7',
            'description' => 'eval=maximumRecordsChecked, table wide',
            'config' => [
                'type' => 'check',
                'eval' => 'maximumRecordsChecked',
                'validation' => [
                    'maximumRecordsChecked' => 1,
                ],
            ],
        ],
    ],
]
Copied!

Example: Toggle checkbox with invertStateDisplay

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_18' => [
            'label' => 'checkbox_18',
            'description' => 'renderType=checkboxToggle single inverted state display',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        'label' => 'foo',
                        'invertStateDisplay' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Example: Three checkboxes, two with labels, one without

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_3' => [
            'label' => 'checkbox_3',
            'description' => 'three checkboxes, two with labels, one without',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                    [
                        'label' => '',
                    ],
                    [
                        'label' => 'foobar',
                        'iconIdentifierChecked' => 'content-beside-text-img-below-center',
                        'iconIdentifierUnchecked' => 'content-beside-text-img-below-center',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Example: Checkboxes with itemsProcFunc

The configuration for a custom field select_single_2 could look like this:

<?php

use MyVendor\MyExtension\UserFunctions\MyItemsProcFunc;

return [
    'columns' => [
        'checkbox_itemsProcFunc' => [
            'exclude' => 1,
            'label' => 'checkbox itemsProcFunc',
            'config' => [
                'type' => 'check',
                'items' => [
                    ['label' => 'foo', 'value' => 1],
                    ['label' => 'bar', 'value' => 'bar'],
                ],
                'itemsProcFunc' => MyItemsProcFunc::class . '->itemsProcFunc',
            ],
        ],
    ],
];
Copied!

The referenced itemsProcFunc method should populate the items by filling $params['items']:

<?php

class MyItemsProcFunc
{
    /**
     * Add two items to existing ones
     */
    public function itemsProcFunc(array &$params): void
    {
        $params['items'][] = ['label' => 'item 1 from itemProcFunc()', 'value' => 'val1'];
        $params['items'][] = ['label' => 'item 2 from itemProcFunc()', 'value' => 'val2'];
    }
}
Copied!

In the real world you would use the other passed parameters to dynamically generate the items.

Example: checkboxToggle

Example: checkboxLabeledToggle

Example: Only one record can be checked

In the example below, only one record from the same table will be allowed to have that particular box checked.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_8' => [
            'label' => 'checkbox_8',
            'description' => 'eval=maximumRecordsCheckedInPid, for this PID',
            'config' => [
                'type' => 'check',
                'eval' => 'maximumRecordsCheckedInPid',
                'validation' => [
                    'maximumRecordsCheckedInPid' => 1,
                ],
            ],
        ],
    ],
]
Copied!

Color

New in version 13.0

The TCA type color should be used to render a JavaScript-based color picker. The according database field is generated automatically.

New in version 13.0

Color palettes can be defined via page TSconfig. This way, for example, colors defined in a corporate design can be selected by a simple click.

Example: Define a simple color picker in TCA

A simple color picker:

$aColorField' = [
    'label' => 'Color field',
    'config' => [
        'type' => 'color',
    ]
];
Copied!

Properties of the TCA column type color

Name Type Scope
boolean Proc.
string Display / Proc.
array
array
array
string (keywords) Display
boolean Proc
bool
string, hexadecimal color representation Display
boolean Display
boolean Display / Proc.
integer Display
array Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$colorField = [
    'config' => [
        'type' => 'color',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no color gets selected.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The database field must allow the NULL value.

Example:

EXT:some_extension/Configuration/TCA/tx_sometable.php
..  _columns-color-properties-nullable:

..  confval:: nullable
    :name: color-nullable
    :Path: $GLOBALS['TCA'][$table]['columns'][$field]['config']
    :type: boolean
    :Default: false
    :Scope: Proc

    If set to true, a checkbox will appear, which by default deactivates the
    field. In the deactivated state the field is saved as :sql:`NULL` in the
    database. By activating the checkbox it is possible to set a value.
    If nothing is entered into the field, then an empty string will be
    saved and not a :sql:`NULL`.

    The database field must allow the :sql:`NULL` value.

Example:

..  literalinclude:: _Properties/_Nullable.rst.txt
    :caption: EXT:some_extension/Configuration/TCA/tx_sometable.php


Copied!

opacity

opacity
Type
bool
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['opacity']

New in version 13.3

If enabled, editors can select not only a color but also adjust its opacity (how transparent the color should be) in a color element.

Colors with an opacity are saved with the the RRGGBBAA color notation.

Example: Allow adjustment of opacity in a color picker
A color picker with adjustable opacity

A color picker with adjustable opacity

EXT:my_extension/Configuration/TCA/Overrides/some_table.php
$temporaryColumns['aColorField'] = [
    'label' => 'My Color',
    'config' => [
        'type' => 'color',
        'opacity' => true,
    ],
];
Copied!

placeholder

placeholder
Type
string, hexadecimal color representation
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a hexadecimal color representation.

<?php

$temporaryColumns['aColorField'] = [
    'title' => 'My color field',
    'config' => [
        'type' => 'color',
        'placeholder' => '#FF8700',
        'mode' => 'useOrOverridePlaceholder',
    ],
];
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

valuePicker

valuePicker
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders a select box with static values next to the input field. When a value is selected in the box, the value is transferred to the field. Keys:

items (array)
An array with selectable items. Each item is an array with the first value being the label in the select drop-down (LLL reference possible) the second being the hex-value transferred to the input field. The value should have exactly 7 characters, as this is the maximum for a hex-value.
Example
EXT:my_extension/Configuration/TCA/Overrides/some_table.php
<?php

$temporaryColumns['aColorField'] = [
    'label' => 'Color field',
    'config' => [
        'type' => 'color',
        'required' => true,
        'size' => 20,
        'valuePicker' => [
            'items' => [
                ['typo3 orange', '#FF8700'],
            ],
        ],
    ],
];
Copied!

Datetime

Changed in version 13.0

The database type has changed from int signed to bigint signed when the field is auto-generated (with the exception of the columns tstamp, crdate, starttime, endtime that still use int signed). This allows to store dates from some million years ago to far into the future.

The TCA type datetime should be used to input values representing a date time or datetime. The according database field is generated automatically as bigint signed.

Example: A simple date field, stored as bigint

A simple date field, stored as bigint in the database:

EXT:my_extension/Configuration/TCA/Overrides/some-table.php
<?php

$temporaryColumns['my-date'] = [
    'label' => 'Datetime field',
    'config' => [
        'type' => 'datetime',
        'format' => 'date',
        'default' => 0,
    ],
];
Copied!

Properties of the TCA column type datetime

Name Type Scope
boolean Proc.
string Proc.
string Display / Proc.
boolean Display
array
array
array
string (keyword) Display
string (keywords) Display
boolean Proc
integer Unix timestamp Display
array Proc.
boolean Display
array Search
boolean
boolean
string
string Proc.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$datetimeField = [
    'config' => [
        'type' => 'datetime',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbType

dbType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['dbType']
Scope
Proc.

If set, the date or time will not be stored as timestamp, but as native date, time or datetime field in the database. Keep in mind that no timezone conversion will happen.

Example: Date and time picker stored in a datetime field
ext_tables.sql
CREATE TABLE tx_example_domain_model_foo (
  synced_at datetime default NULL
)
Copied!
EXT:some_extension/Configuration/TCA/tx_sometable.php
<?php

$temporaryColumns['synced_at'] = [
    'config' => [
        'type' => 'datetime',
        'dbType' => 'datetime',
        'nullable' => true,
    ],
];
Copied!
Example: Time picker stored in a datetime field
ext_tables.sql
CREATE TABLE tx_example_domain_model_foo (
   synced_at time default NULL
)
Copied!
EXT:some_extension/Configuration/TCA/tx_sometable.php
<?php

$temporaryColumns['synced_at'] =  [
    'config' => [
        'type' => 'datetime',
        'dbType' => 'time',
        'format' => 'time',
        'nullable' => true,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no date gets initially selected.

disableAgeDisplay

disableAgeDisplay
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['disableAgeDisplay']
Scope
Display

Disable the display of the age (for example "2015-08-30 (-27 days)") of date fields in some places of the backend, for instance the list module.

It will be respected if the field has the type datetime and it's eval is set to date.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

format

format
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['format']
Scope
Display

Sets the output format if the field is set to read-only. Read-only fields with format set to "date" will be formatted as "date", "datetime" as "datetime", "time" as "time" and "timesec" as "timesec".

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['nullable']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The database field must allow the NULL value.

Example:
EXT:some_extension/Configuration/TCA/tx_sometable.php
<?php

$temporaryColumns['my-date'] = [
    'title' => 'A nullable date',
    'config' => [
        'type' => 'datetime',
        'nullable' => true,
    ],
];
Copied!

placeholder

placeholder
Type
integer Unix timestamp
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a default date.

EXT:my_extension/Configuration/TCA/Overrides/some-table.php
<?php

$temporaryColumns['my-date'] = [
    'title' => 'My datetime field',
    'config' => [
        'type' => 'datetime',
        'placeholder' => gmmktime(0, 0, 0, 1, 1, 2024),
        'mode' => 'useOrOverridePlaceholder',
    ],
];
Copied!

range

range
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

An array which defines an integer range within which the value must be. Keys:

lower
Defines the earliest date.
upper
Defines the latest date.

It is allowed to specify only one or both of them.

In this example the upper limit is set to the last day in year 2022 while the lowest possible value is set to the date of 2014:

EXT:some_extension/Configuration/TCA/tx_sometable.php
$temporaryColumns['my-date']['config']['range'] => [
    'upper' => gmmktime(23, 59, 59, 12, 31, 2022),
    'lower' => gmmktime(0, 0, 0, 1, 1, 2014),
];
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

search

Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
Scope
Search
Types
input

Defines additional search-related options for a given field.

pidonly

pidonly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']

Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.

case

case
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']

Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.

andWhere

andWhere
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']

Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched

EXT:some_extension/Configuration/TCA/tx_sometable.php
$temporaryColumns['some_date'] => [
    'config' => [
        'search' => [
            'andWhere' => '{#CType}=\'type_x\' OR {#CType}=\'type_y\'',
        ],
        // ...
    ],
];
Copied!

This means that the "some_date" field of the "tt_content" table will be searched in only for elements of type X and Y. This helps making any search more relevant.

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

softref

softref
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
input

Used to attach "soft reference parsers".

The syntax for this value is key1,key2[parameter1;parameter2;...],...

See Soft references of core API for more details about softref keys.

Email

New in version 13.0

The TCA type email should be used to input values representing email addresses. The according database field is generated automatically.

Table of contents

Properties of the TCA column type email

Name Type Scope
boolean Proc.
boolean Display
string (list of keywords) Display / Proc.
array
array
array
string (keywords) Display
boolean Proc
integer Unix timestamp Display
boolean Display
boolean Display / Proc.
integer Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$emailField = [
    'config' => [
        'type' => 'email',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

autocomplete

autocomplete
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Controls the autocomplete attribute of a given email field. If set
to true, adds attribute autocomplete="on" to the email input field allowing browser auto filling the field:
<?php

$temporaryColumns['email'] = [
    'label' => 'email',
    'config' => [
        'type' => 'email',
        'size' => 20,
        'nullable' => true,
        'autocomplete' => true,
    ],
];
Copied!

eval

eval
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Configuration of field evaluation.

Some of these evaluation keywords will trigger a JavaScript pre- evaluation in the form. Other evaluations will be performed in the backend. The evaluation functions will be executed in the list-order. Keywords:

unique

Requires the field to be unique for the whole table. Evaluated on the server only.

uniqueInPid
Requires the field to be unique for the current PID among other records on the same page. Evaluated on the server only.
Example: Email field unique on the storage page

Require an email address to be unique for this record type in this folder

<?php

$temporaryColumns['email'] = [
    'label' => 'aLabel',
    'config' => [
        'type' => 'email',
        'eval' => 'uniqueInPid',
    ],
];
Copied!

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['nullable']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

When the eval option is set to unique or uniqueInPid multiple null values are still possible.

The database field must allow the NULL value.

Example:
EXT:some_extension/Configuration/TCA/tx_sometable.php
'columns' => [
     'nullable_column' => [
          'title' => 'A nullable field',
          'config' => [
                'type' => 'email',
                'nullable' => true,
                'eval' => 'uniqueInPid',
          ],
     ],
],
Copied!

placeholder

placeholder
Type
integer Unix timestamp
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a default date.

EXT:my_extension/Configuration/TCA/Overrides/some-table.php
<?php

$temporaryColumns['my-date'] = [
    'title' => 'My email field',
    'config' => [
        'type' => 'email',
        'placeholder' => 'info@example.com',
        'mode' => 'useOrOverridePlaceholder',
    ],
];
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders the field in a way that the user can see the values but cannot edit them. The rendering is as similar as possible to the normal rendering but may differ in layout and size.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the email field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

File

New in version 13.0

The TCA type file creates a field where files can be attached to the record. The according database field is generated automatically.

Table of contents

Examples

EXT:my_extension/Configuration/TCA/some_table.php
<?php

return [
    // ...
    'columns' => [
        'my_image' => [
            'label' => 'My image',
            'config' => [
                'type' => 'file',
                'maxitems' => 6,
                'allowed' => 'common-image-types',
            ],
        ],
        // ...
    ],
];
Copied!

Properties of the TCA column type file

Name Type Scope
string / array Proc. / Display
array Display
boolean Proc.
boolean Proc.
boolean Proc.
array Proc. / Display
array Display
array
array
array
integer > 0 Display / Proc.
integer > 0 Display
array Display
boolean Display

allowed

allowed
Type
string / array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

One or more (comma-separated) of the following reserved strings:

common-image-types
Gets replaced with the value from $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] .
common-text-types
Gets replaced with the value from $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'] .
common-media-types
Gets replaced with the value from $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'] .

Additionally, specific allowed file extensions can be added (comma separated), for example 'common-image-types, common-text-types, gz, zip.

You can also use the array notation of allowed file extensions, for example ['jpg','png','svg'] or ['common-image-types', 'gz', 'zip'].

New in version 13.1.0

Due to a bug, the array notation only properly works since TYPO3 13.1.0 and v12.4.1 and upwards. Use the string notation for earlier versions instead.

appearance

appearance
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Has information about the appearance of child-records, namely:

collapseAll (boolean)
Show all child-records collapsed (if false, all are expanded)
expandSingle (boolean)
Show only one child-record expanded each time. If a collapsed record is clicked, the currently open one collapses and the clicked one expands.
createNewRelationLinkTitle (string or LLL reference)
Overrides the link text and title of the "Create new relation" button with a localized string. Only useful, if the element browser is enabled.
addMediaLinkTitle (string or LLL reference)
Overrides the link text and title of the "Add media by URL" button with a localized string. Only useful, if the element browser is enabled.
uploadFilesLinkTitle (string or LLL reference)
Overrides the link text and title of the "Select & upload files" button with a localized string. Only useful, if the element browser is enabled.
useSortable (boolean)
Activate drag & drop.
showPossibleLocalizationRecords (boolean)
Show unlocalized files which are in the original language, but not yet localized.
showAllLocalizationLink (boolean)
Defines whether to show the "localize all records" link to fetch untranslated records from the original language.
showSynchronizationLink (boolean)
Defines whether to show a "synchronize" link to update to a 1:1 translation with the original language.
enabledControls (array)
Associative array with the keys 'info', 'new', 'dragdrop', 'sort', 'hide', 'delete', 'localize'. If the accordant values are set to a boolean value (true or false), the control is shown or hidden in the header of each record.
headerThumbnail (array)

Defines whether a thumbnail should be rendered in the inline element's header. This is used by the file abstraction layer to render a preview of the related image. Can contain image processing instructions like width and height.

field (required)
The table column name, which contains the uid of the image reference. Usually this is uid_local.
width
The width of the thumbnail.
height
The height of the thumbnail.
fileUploadAllowed (boolean)

Defines whether the button "Select & upload file" should be rendered. This can be used for file fields to directly upload files and create a reference to the file. The button is limited to file fields using File Abstraction Layer. It will only appear to backend users which have write access to the user upload folder. By default this folder is fileadmin/user_upload but it can be changed in User TSconfig using options.defaultUploadFolder. See the TSconfig reference.

The button is shown by default unless this option is set to false.

fileByUrlAllowed (boolean)
Defines whether the button "Add media by URL" should be rendered. This button is used to include media URLs from, for example, Vimeo or YouTube.
elementBrowserEnabled (boolean)
Hides or displays the element browser button in inline records

This property can also be overridden by page TSconfig.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

This property can also be overridden by page TSconfig.

disableMovingChildrenWithParent

disableMovingChildrenWithParent
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['disableMovingChildrenWithParent']
Scope
Proc.

Default false. Disables that child records get moved along with their parent records. Usually if in a parent-child relation a parent record is moved to a different page (eg. via cut+paste from clipboard), the children are relocated along with the parent. This flag disables the child move.

This property can also be overridden by page TSconfig.

enableCascadingDelete

enableCascadingDelete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['enableCascadingDelete']
Scope
Proc.
Default
true

Usually when the parent record is deleted all attached sys_file_references are deleted. This default behaviour can be disabled here.

This property can also be overridden by page TSconfig.

disallowed

disallowed
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

An array of file extensions that are not allowed even though they are listed in the property allowed, for example ['doc','docx'].

fieldInformation

fieldInformation
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Show information between an element label and the main element input area. Configuration works identical to the "fieldWizard" property, no default configuration in the core exists (yet). In contrast to "fieldWizard", HTML returned by fieldInformation is limited, see FormEngine docs for more details.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of files that can be attached. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

This property can also be overridden by page TSconfig.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
group, inline
Default
0

Minimum number of attached files. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

This property can also be overridden by page TSconfig.

Example, exactly one image has to be attached:

// After
'columns' => [
    'image' => [
        'label' => 'My one and only image',
        'config' => [
            'type' => 'file',
            'minitems' => 1,
            'maxitems' => 1,
            'allowed' => 'common-image-types'
        ],
    ],
],
Copied!

overrideChildTca

overrideChildTca
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Override the TCA of the sys_file_reference records representing the files attached to this record.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The files attached to this record are displayed but cannot be changed in the backend form.

This property can also be overridden by page TSconfig.

FlexForm field

New in version 13.0

Renders a FlexForm element. Essentially, this consists in a hierarchically organized set of fields which will have their values saved into a single field in the database, stored as XML.

The according database field is generated automatically.

The general idea is: There is a data structure that defines which and how single fields should be displayed, re-using all the TCA column type possibilities. The actual values of single fields are then stored in an XML representation within this "flex" field.

Properties of the TCA column type flex

Changed in version 13.0

The configuration options ds_tableField, ds_pointerField_searchParent_subField and ds_pointerField_searchParent are not handled anymore. Use the Events to replace their logic if needed.

Name Type Scope
boolean Proc.
array Display / Proc.
string Display / Proc.
array
array
array
boolean Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$flexField = [
    'config' => [
        'type' => 'flex',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

ds

ds
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Data Structure(s) defined in an array.

Each key is a value that can be pointed to by ds_pointerField. Default key is "default" which is what you should use if you do not have a ds_pointerField value of course.

If you specified more than one ds_pointerField, the keys in this "ds" array should contain comma-separated value pairs where the asterisk * matches all values (see the example below). If you don't need to switch for the second ds_pointerField, it's also possible to use only the first ds_pointerField's value as a key in the "ds" array without necessarily suffixing it with ",*" for a catch-all on the second ds_pointerField.

For each value in the array there are two options:

  • Make a reference to an external XML file
  • Either enter XML directly
Example with XML in external file
EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_file_1' => [
            'label' => 'flex_file_1 simple flexform in external file',
            'description' => 'field description',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => 'FILE:EXT:styleguide/Configuration/FlexForms/Simple.xml',
                ],
            ],
        ],
    ],
]
Copied!

The included file:

<T3DataStructure>
    <sheets>
        <sDEF>
            <ROOT>
                <sheetTitle>Sheet Title</sheetTitle>
                <type>array</type>
                <el>
                    <input_1>
                        <label>input_1</label>
                        <config>
                            <type>input</type>
                        </config>
                    </input_1>
                </el>
            </ROOT>
        </sDEF>
    </sheets>
</T3DataStructure>
Copied!
Example with XML directly entered
EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_2' => [
            'label' => 'flex_2 section container',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => '
                        <T3DataStructure>
                            <sheets>
                                <sSection>
                                    <ROOT>
                                        <sheetTitle>section</sheetTitle>
                                        <type>array</type>
                                        <el>
                                            <section_1>
                                                <title>section_1</title>
                                                <type>array</type>
                                                <section>1</section>
                                                <el>
                                                    <container_1>
                                                        <type>array</type>
                                                        <title>container_1</title>
                                                        <el>
                                                            <input_1>
                                                                <label>input_1 description</label>
                                                                <description>field description</description>
                                                                <config>
                                                                    <type>input</type>
                                                                </config>
                                                            </input_1>
                                                            <color_1>
                                                                <label>color_1</label>
                                                                <config>
                                                                    <type>color</type>
                                                                    <size>10</size>
                                                                </config>
                                                            </color_1>
                                                        </el>
                                                    </container_1>
                                                    <container_2>
                                                        <type>array</type>
                                                        <title>container_2</title>
                                                        <el>
                                                            <text_1>
                                                                <label>text_1 default "foo"</label>
                                                                <config>
                                                                    <type>text</type>
                                                                    <default>foo</default>
                                                                </config>
                                                            </text_1>
                                                        </el>
                                                    </container_2>
                                                </el>
                                            </section_1>
                                        </el>
                                    </ROOT>
                                </sSection>
                            </sheets>
                        </T3DataStructure>
                    ',
                ],
            ],
        ],
    ],
]
Copied!

ds_pointerField

ds_pointerField
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Field name(s) in the record which point to the field where the key for "ds" is found. Up to two field names can be specified comma separated.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

Defining multiple data structures for different records

There can be multiple data structures defined in TCA and it depends on the configuration and the record which one is chosen. If the ds and ds_pointerField are not sufficient, you can use the Events to manipulate with data structure should be displayed.

Events to manipulate the FlexForm data structure

There are appropriate events that allow the manipulation of the data structure lookup logic:

About the data structure

Basically, the configuration for a FlexForm field is all about pointing to the data structure which contains form rendering information.

For general information about the backbone of a Data Structure, please refer to the "<T3DataStructure>" chapter in the Core API manual.

The mixture of the different "ds" properties can be puzzling at first, but they allow powerful combinations to specify which data structure should be used in different scenarios.

One data structure only

'config' => [
    'type' => 'flex',
    'ds' => [
        'default' => 'FILE:EXT:my_extension/Configuration/FlexForms/Main.xml',
    ],
],
Copied!

Straight and simple: Whenever a record is handled that has a column field definition with this TCA, the data structure defined in FILE:EXT:my_extension/Configuration/FlexForms/Main.xml is parsed and the flex form defined in there is displayed.

Data structure selection depends on a field value

'config' => [
    'type' => 'flex',
    'ds_pointerField' => 'selector'
    'ds' => [
        'default' => 'FILE:EXT:my_extension/Configuration/FlexForms/Default.xml',
        'foo' => 'FILE:EXT:my_extension/Configuration/FlexForms/Foo.xml',
        'bar' => 'FILE:EXT:my_extension/Configuration/FlexForms/Bar.xml',
    ],
],
Copied!

There are now multiple data structures registered for this "flex" field. It depends on the value of the field "selector" which one is chosen: If "selector" value is "foo", "Foo.xml" is parsed and displayed, "Bar.xml" is chosen for the value "bar", and if none of the two matches, it falls back to "Default.xml".

FlexForm syntax

FlexForms create a form-in-a-form. The content coming from this form is still stored in the associated database field - but as an XML structure, stored by \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array().

The "TCA" information needed to generate the FlexForm fields are found inside a <T3DataStructure> XML document. When you configure a FlexForm field in a Data Structure (DS) you can use basically all column types documented here for TCA. The limitations are:

  • "unique" and "uniqueInPid" evaluation is not available
  • You cannot nest FlexForm configurations inside of FlexForms.
  • You cannot add, change or remove fields in FlexForms without copying the data structure and changing the configuration accordingly.
  • Charset follows that of the current backend UTF-8. When storing FlexForm information in external files, make sure that they are using UTF-8 too.
  • type='inline' and other types that point to different tables are not allowed in FlexForm section containers.

Changed in version 13.0

The tables below documents the extension elements:

Array Elements

<meta>

Element
<meta> Can contain application specific meta settings. For FlexForms this means a definition of how languages are handled in the form.

<[application tag]>

Element
A direct reflection of a ['columns']['field name']['config'] PHP array configuring a field in TCA. As XML, this is expressed by array2xml()'s output.

<ROOT>

Element

<ROOT> For <ROOT> elements in the DS you can add application specific information about the sheet that the <ROOT> element represents.

Child elements

<sheetTitle>

<sheetDescription>

<sheetShortDescr>

Value Elements

<sheetTitle>

Element
<sheetTitle>
Format
string or LLL reference Specifies the title of the sheet.

<sheetDescription>

Element
<sheetDescription>
Format
string or LLL reference Specifies a description for the sheet shown in the flexform.

<sheetShortDescr>

Element
<sheetShortDescr>
Format
string or LLL reference Specifies a short description of the sheet used in the tab-menu.

Sheets and FlexForms

FlexForms always resolve sheet definitions in a Data Structure. If only one sheet is defined that must be the "sDEF" sheet (default). In that case no tab-menu for sheets will appear (see examples below).

FlexForm data format, <T3FlexForms>

When saving FlexForm elements the content is stored as XML using \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml() to convert the internal PHP array to XML format. The structure is as follows:

<T3FlexForms>

Element

<T3FlexForms> Document tag

Child elements

<meta>

<data>

<meta>

Element
<meta> Meta data for the content. For instance information about which sheet is active etc.

<data>

Element

<data> Contains the data: sheets, language sections, field and values

Child elements
<sheet>

<sheets>

Element

<sheets> Contains the data for each sheet in the form. If there are no sheets, the default sheet "<sDEF>" is always used.

Child elements

<sDEF>

<s_[sheet keys]>

<sDEF>

Element

<sDEF> For each sheet it contains elements for each language. only the <lDEF> tag is used.

Child elements
<lDEF>

<lDEF>

Element

<lDEF> For each language the fields in the form will be available on this level.

Child elements
<[field name]>

<[field name]>

Element

<[field name]> For each field name there is at least one element with the value, <vDEF>.

Child elements
<vDEF>

<vDEF>

Element
<vDEF>
Format
string Content of the field in default or localized versions.

Examples

Simple FlexForm

The extension styleguide provides some sample FlexForms. The "simple FlexForm" field provides a very basic configuration with just a select-type field to choose a page from the table pages.

A field with a simple, one-field flex form

The corresponding TCA column loads the DataStructure (ds) form an external XML file:

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_file_1' => [
            'label' => 'flex_file_1 simple flexform in external file',
            'description' => 'field description',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => 'FILE:EXT:styleguide/Configuration/FlexForms/Simple.xml',
                ],
            ],
        ],
    ],
]
Copied!

The DataStructure used to render this field is found in the file "Simple.xml" inside the styleguide extension. Notice the <input_1> tag:

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_file_1' => [
            'label' => 'flex_file_1 simple flexform in external file',
            'description' => 'field description',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => 'FILE:EXT:styleguide/Configuration/FlexForms/Simple.xml',
                ],
            ],
        ],
    ],
]
Copied!

It's clear that the contents of <input_1> is a direct reflection of the field configurations we normally set up in the $GLOBALS['TCA'] array.

FlexForm in a plugin

The data structure for a FlexForm can also be loaded in the pi_flexform field of the tt_content table by adding the following in the TCA Overrides of an extension, see this example from the extension t3docs/blog-example :

EXT:blog_example/Configuration/TCA/Overrides/tt_content.php
<?php

declare(strict_types=1);
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

defined('TYPO3') or die();

$pluginKey = ExtensionUtility::registerPlugin(
    'blog_example',
    'BlogList',
    'List of Blogs (BlogExample)',
    'blog_example_icon',
    'plugins',
    'Display a list of blogs',
);

ExtensionManagementUtility::addToAllTCAtypes(
    'tt_content',
    '--div--;Configuration,pi_flexform',
    $pluginKey,
    'after:subheader',
);

ExtensionManagementUtility::addPiFlexFormValue(
    '*',
    'FILE:EXT:blog_example/Configuration/FlexForms/PluginSettings.xml',
    $pluginKey,
);
Copied!

In line 18ff the field pi_flexform is added to the display of fields when the record type of the plugin is selected.

In line 25ff the method addPiFlexFormValue() from class ExtensionManagementUtility is used to register the FlexForm.

Example: FlexForm with two sheets

This example provides a FlexForm field with two "sheets". Each sheet can contain a separate FlexForm structure. Each sheet can also have a sheet descriptions:

A field with a simple, one-field flex form

In this example the FlexForm data structure is saved directly into the TCA field:

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_1' => [
            'label' => 'flex_1 sheet description',
            'description' => 'field description',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => '
                        <T3DataStructure>
                            <sheets>
                                <sSheetdescription_1>
                                    <ROOT>
                                        <sheetTitle>sheet description 1</sheetTitle>
                                        <sheetDescription>
                                            sheetDescription: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                            Nam id ante ornare, iaculis elit a, malesuada augue. Etiam neque odio,
                                            condimentum sed dolor vitae, sollicitudin varius lacus. Pellentesque sit amet aliquam arcu.
                                            Phasellus ut euismod felis. Fusce at tempor turpis.

                                            Nam eu arcu id lorem vestibulum tristique vel in erat. Phasellus maximus, arcu nec
                                            condimentum venenatis, mauris nisl venenatis tellus, eget suscipit arcu nunc et purus.
                                            Nunc luctus congue vulputate. Donec placerat, lorem vitae rhoncus euismod, ipsum ligula
                                            tempor sapien, ac sodales metus mauris et lacus. Donec in ante a lectus semper rutrum nec
                                            ut orci. Quisque id mi ultrices lacus fermentum consequat quis sed odio. Sed quis turpis
                                            rutrum, convallis sem vitae, cursus enim. Maecenas sit amet sem nisi.
                                        </sheetDescription>
                                        <sheetShortDescr>
                                            sheetShortDescr: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                            Nam id ante ornare, iaculis elit a, malesuada augue. Etiam neque odio,
                                            condimentum sed dolor vitae, sollicitudin varius lacus. Pellentesque sit amet aliquam arcu.
                                            Phasellus ut euismod felis. Fusce at tempor turpis.
                                        </sheetShortDescr>
                                        <type>array</type>
                                        <el>
                                            <input_1>
                                                <label>input_1</label>
                                                <config>
                                                    <type>input</type>
                                                </config>
                                            </input_1>
                                        </el>
                                    </ROOT>
                                </sSheetdescription_1>
                                <sSheetdescription_2>
                                    <ROOT>
                                        <sheetTitle>sheet description 2</sheetTitle>
                                        <sheetDescription>
                                            foo
                                        </sheetDescription>
                                        <sheetShortDescr>
                                            bar
                                       </sheetShortDescr>
                                        <type>array</type>
                                        <el>
                                            <input_2>
                                                <label>input_2</label>
                                                <config>
                                                    <type>input</type>
                                                </config>
                                            </input_2>
                                        </el>
                                    </ROOT>
                                </sSheetdescription_2>
                            </sheets>
                        </T3DataStructure>
                    ',
                ],
            ],
        ],
    ],
]
Copied!

Notice how the data of the two sheets are separated.

A flex form field with two flex section containers

A flex form with two sheets and descriptions

In this example the FlexForm data structure is saved directly into the TCA field:

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_2' => [
            'label' => 'flex_2 section container',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => '
                        <T3DataStructure>
                            <sheets>
                                <sSection>
                                    <ROOT>
                                        <sheetTitle>section</sheetTitle>
                                        <type>array</type>
                                        <el>
                                            <section_1>
                                                <title>section_1</title>
                                                <type>array</type>
                                                <section>1</section>
                                                <el>
                                                    <container_1>
                                                        <type>array</type>
                                                        <title>container_1</title>
                                                        <el>
                                                            <input_1>
                                                                <label>input_1 description</label>
                                                                <description>field description</description>
                                                                <config>
                                                                    <type>input</type>
                                                                </config>
                                                            </input_1>
                                                            <color_1>
                                                                <label>color_1</label>
                                                                <config>
                                                                    <type>color</type>
                                                                    <size>10</size>
                                                                </config>
                                                            </color_1>
                                                        </el>
                                                    </container_1>
                                                    <container_2>
                                                        <type>array</type>
                                                        <title>container_2</title>
                                                        <el>
                                                            <text_1>
                                                                <label>text_1 default "foo"</label>
                                                                <config>
                                                                    <type>text</type>
                                                                    <default>foo</default>
                                                                </config>
                                                            </text_1>
                                                        </el>
                                                    </container_2>
                                                </el>
                                            </section_1>
                                        </el>
                                    </ROOT>
                                </sSection>
                            </sheets>
                        </T3DataStructure>
                    ',
                ],
            ],
        ],
    ],
]
Copied!

Example: Rich Text Editor in FlexForms

Creating a RTE in FlexForms is done by enabling enableRichtext content to the tag of the field:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
<rte_1>
   <label>rte_1</label>
   <config>
       <type>text</type>
       <enableRichtext>1</enableRichtext>
   </config>
</rte_1>
Copied!

Folder

New in version 13.0

The TCA type folder creates a field where folders can be attached to the record. The values are stored as a combined identifier in a comma-separated list (csv). The according database field is generated automatically.

Table of contents

Examples

'columns' => [
    'aColumn' => [
        'config' => [
            'type' => 'folder',
        ],
    ],
],
Copied!

Properties of the TCA column type folder

Name Type Scope
boolean Proc.
integer Display
array Display
array fieldControl
array
array
array
boolean Display
boolean Display
integer > 0 Display / Proc.
integer > 0 Display
boolean Display / Proc.
boolean Display
integer Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$folderField = [
    'config' => [
        'type' => 'folder',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

elementBrowserEntryPoints

elementBrowserEntryPoints
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

By default, the last folder is used when opening the element browser. Setting this configuration value changes this behaviour.

This configuration value contains an array. For the column type folder only the value with the key _default is used.

When opening the element browser the folder with the _default key is preselected.

Example: Open the element type on a specific folder

You can also define an entry point with the _default key:

'folder_group' => [
    'label' => 'Folder field',
    'config' => [
        'type' => 'folder',
        'elementBrowserEntryPoints' => [
            '_default' => '1:/styleguide/'
        ]
    ]
],
Copied!

It is also possible to use a special TSconfig key:

'folder_group' => [
    'label' => 'Folder field',
    'config' => [
        'type' => 'folder',
        'elementBrowserEntryPoints' => [
            '_default' => '###PAGE_TSCONFIG_ID###'
        ]
    ]
],
Copied!

This key has then to be defined on field level:

TCEFORM.my_table.folder_group.PAGE_TSCONFIG_ID = 1:/styleguide/subfolder
Copied!

In case an allowed table has no entry point defined, the _default is used. In case _default is also not set or elementBrowserEntryPoints is not used at all, the previous behaviour applies.

fieldControl

fieldControl

The field of type folder can enable all common field control options. Furthermore the following are available:

elementBrowser

elementBrowser
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl

The element browser field control used in type='folder' renders a button to open an element browser to choose a folder.

It is enabled by default if rendering a folder element.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

hideDeleteIcon

hideDeleteIcon
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Removes the delete icon next to the selector box.

hideMoveIcons

hideMoveIcons
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Removes the move icons next to the selector box.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The minimum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

Group fields

New in version 13.0

The group element (type' => 'group') in TYPO3 makes it possible to create references from a record of one table to many records from multiple tables in the system. The foreign tables can be the table itself (thus a self-reference) or any other table. This is especially useful (compared to the "select" type) when records are scattered over the page tree and require the Element Browser to select records for adding them to the group field.

For database relations however, the group field is the right and powerful choice, especially if dealing with lots of re-usable child records, and if type='inline' is not suitable.

This type is very flexible in its display options with all its different fieldControl and fieldWizard options. A lot of them are available by default, however they must be enabled: 'disabled' => 'false'

Most common usage is to model database relations (n:1 or n:m). The property allowed is required, to define allowed relation tables.

The group field uses either the CSV format to store uids of related records or an intermediate mm table (in this case MM property is required).

You can read more on how data is structured in Stored data values chapter.

The according database field is generated automatically.

Properties of the TCA column type group

Name Type Scope
boolean Proc.
string (list) Proc. / Display
integer Display
string Display / Proc.
string (list of tables) Proc.
array Display
array fieldControl
string
array fieldControl
string
array fieldControl
string
array fieldControl
string
array fieldControl
string
array fieldWizard
array Proc. / Display
string (table name) Proc. / Display
boolean Display
boolean Display
boolean Display
boolean Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
boolean Display / Proc.
boolean Proc.
boolean Display
integer Display
array Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$groupField = [
    'config' => [
        'type' => 'group',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

allowed

allowed
Type
string (list)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

A comma list of tables from $GLOBALS['TCA'] , for example "pages,be_users".

Example: Group relation to be_groups and be_users
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Default value set if a new record is created. If empty, the first element in the items array is selected.

dontRemapTablesOnCopy

dontRemapTablesOnCopy
Type
string (list of tables)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
Description

A list of tables which should not be remapped to the new element uids if the field holds elements that are copied in the session.

elementBrowserEntryPoints

elementBrowserEntryPoints
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

By default, the last selected page is used when opening the element browser. Setting this configuration value changes this behaviour.

This configuration value is a PHP array, containing table => id pairs. When opening the element browser for a specific table (buttons below the group field), the defined page is then always selected by default. There is also the special _default key, used for the general element browser button (on the right side of the group field), which is not dedicated to a specific table.

This configuration value also supports the known markers ###SITEROOT###, ###CURRENT_PID### and ###PAGE_TSCONFIG_<key>###.

Each table => id pair can also be overridden via page TSconfig.

Example: Open the element browser on page 123 for tt_content elements
'simple_group' => [
    'label' => 'Simple group field',
    'config' => [
        'type' => 'group',
        'allowed' => 'tt_content',
        'elementBrowserEntryPoints' => [
            'tt_content' => 123,
        ]
    ]
],
Copied!

This could then be overridden via page TSconfig:

TCEFORM.my_table.simple_group.config.elementBrowserEntryPoints.tt_content = 321
Copied!

Since only one table is allowed, the defined entry point is also automatically used for the general element browser button.

Example: Open the element browser on different pages for tt_content and news records

In case the group field allows more than one table, the _default key has to be set:

'extended_group' => [
    'label' => 'Extended group field',
    'config' => [
        'type' => 'group',
        'allowed' => 'tt_content,tx_news_domain_model_news',
        'elementBrowserEntryPoints' => [
            '_default' => '###CURRENT_PID###' // E.g. use a special marker
            'tt_content' => 123,
            'tx_news_domain_model_news' => 124,
        ]
    ]
],
Copied!

Of course, the _default key can also be overridden via page TSconfig:

TCEFORM.my_table.extended_group.config.elementBrowserEntryPoints._default = 122
Copied!

fieldControl

fieldControl

The field of type group can enable all common field control options. Furthermore the following are available:

addRecord

addRecord
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

Control button to directly add a related record. Leaves the current view and opens a new form to add a new record. On 'Save and close', the record is directly selected as referenced element in the type='group' field. If multiple tables are allowed, the first table from the allowed list is selected, if no specific table option is given.

Example: Group field with add popup enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

renderType

renderType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['renderType']
Required
true
Default
addRecord

Use a render type from core or your own. Custom render types can be registered with the NodeFactory.

editPopup

editPopup
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

The edit popup field control shows a pencil icon to edit an element directly in a popup window. When a record is selected and the edit button is clicked, that record opens in a new window for modification.

For details see editPopup.

Example: Group field with edit popup enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

renderType

renderType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']['renderType']
Required
true
Default
editPopup

Use a render type from core or your own. Custom render types can be registered with the NodeFactory.

listModule

listModule
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

The list module control button opens the Web > List module for only one table and allows the user to manipulate stuff there.

For details see listModule.

Example: Group field with add list module enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

renderType

renderType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['listModule']['renderType']
Required
true
Default
listModule

Use a render type from core or your own. Custom render types can be registered with the NodeFactory.

elementBrowser

elementBrowser
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

The element browser field control used in type='group' renders a button to open an element browser. It is enabled by default if rendering a group element.

renderType

renderType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['elementBrowser']['renderType']
Required
true
Default
elementBrowser

Use a render type from the Core or an Extension. Custom render types can be registered with the NodeFactory.

insertClipboard

insertClipboard
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
group

renderType

renderType
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['insertClipboard']['renderType']
Required
true
Default
insertClipboard

Use a render type from core or your own. Custom render types can be registered with the NodeFactory.

The clipboard control adds a control button for type='group' to paste records from a users clipboard into the selection. It is enabled by default for type='group' and shown below the element browser if the order has not been changed using the before and after keywords. It can be turned off by setting disabled to true, just like any other fieldControl.

Example: Group field with element browser enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: Group field with element browser disabled

The element browser control can be disabled by setting disabled = true:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_3' => [
            'label' => 'group_db_3 allowed=tx_styleguide_staticdata, disabled elementBrowser',
            'config' => [
                'type' => 'group',
                'allowed' => 'tx_styleguide_staticdata',
                'fieldControl' => [
                    'elementBrowser' => [
                        'disabled' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

For general fieldWizard documentation see here.

recordsOverview

recordsOverview
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']
Scope
fieldWizard

Render an overview of the selected records with correct icon and click menu and title. Allows to perform actions on the selected records directly. Links the record title to a direct editing form.

tableList

tableList
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']

type

array

Scope

fieldWizard

Render a list of allowed tables and link to element browser. This field wizard is enabled by default. This wizard allows to easily select records from a popup.

filter

filter
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

Define filters for item values. Doesn't work in combination with a wizard.

This is useful when only foreign records matching certain criteria should be allowed to be used as values in the group field. The values are filtered in the Element Browser as well as during processing in DataHandler. Filter userFuncs should have two input arguments ($parameters and $parentObject). The first argument ($parameters) is an array with the parameters of the filter as configured in the TCA, but with the additional parameter "values", which contains the array of values which should be filtered by the userFunc. The function must return the filtered array of values.

Multiple filters can be defined, and an array of configuration data for each of the filters can be supplied:

'filter' => [
    [
        'userFunc' => \Vendor\Extension\MyClass::class . '->doFilter',
        'parameters' => [
            // optional parameters for the filter go here
        ],
    ],
    [
        'userFunc' => \Vendor\Extension\OtherClass::class . '->myFilter',
        'parameters' => [
            // optional parameters for the filter go here
        ],
    ],
],
Copied!
Example:

Say you have a "person" table with fields "gender" (radio buttons) as well as "mother" and "father", both group fields with relations to the same table.

Now, in the field "mother" it should certainly only be possible to create relations to female persons. In that case, you could use the filter functionality to make sure only females can be selected in that field.

The field configuration for the "mother" field could look like:

'mother' => [
    'label' => 'Mother',
    'config' => [
        'type' => 'group',
        'allowed' => 'tx_myext_person',
        'size' => 1,
        'filter' => [
            [
                'userFunc' => \Vendor\Extension\MyClass::class . '->doFilter',
                'parameters' => [
                    'evaluateGender' => 'female',
                ],
            ],
        ],
    ]
],
Copied!

The corresponding filter class would look like:

class MyClass
{
    public function doFilter(array $parameters, $parentObject)
    {
        $fieldValues = $parameters['values'];
        // do the filtering here
        return $fieldValues;
    }
}
Copied!

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

This property does not really exist for group-type fields. It is needed as a workaround for an Extbase limitation. It is used to resolve dependencies during Extbase persistence. It should hold the same values as property allowed. Notice that only one table name is allowed here in contrast to the property allowed itself.

hideDeleteIcon

hideDeleteIcon
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Removes the delete icon next to the selector box.

hideMoveIcons

hideMoveIcons
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Removes the move icons next to the selector box.

hideSuggest

hideSuggest
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The "suggest wizard" is added by default to all database relation group fields. After a couple of characters have been typed into this field, an ajax based search starts and shows a list of records matching the search word.

The syntax for the search is: "multiple words" something, so you can enclose words you want to find next to each other in double quotes.

A set of options is available to configure search details.

Setting this property to true disables the suggest wizard.

Example: Suggest wizard is hidden
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_11' => [
            'label' => 'group_db_11 hideSuggest=true allowed=tx_styleguide_staticdata, multiple, autoSizeMax=10',
            'config' => [
                'type' => 'group',
                'hideSuggest' => true,
                'allowed' => 'tx_styleguide_staticdata',
                'multiple' => true,
                'autoSizeMax' => 10,
            ],
        ],
    ],
]
Copied!
Example: Suggest wizard is shown
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_8' => [
            'label' => 'group_db_8 allowed=tx_styleguide_staticdata, multiple',
            'config' => [
                'type' => 'group',
                'hideSuggest' => false,
                'allowed' => 'tx_styleguide_staticdata',
                'multiple' => true,
            ],
        ],
    ],
]
Copied!

localizeReferencesAtParentLocalization

localizeReferencesAtParentLocalization
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Defines whether referenced records should be localized when the current record gets localized. This only applies if references are not stored using MM tables. foreign_table has to reference the same table in allowed.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with allowed (group). If you use Extbase, foreign_table has to contain the same table name additionally.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

The table name used in the field MM should be unique. It must be a valid SQL table name. It is best practise to use the name of both referenced tables and of the field in which the reference is saved on local side. See also naming conventions for mm tables. This way uniqueness can be ensured and it is possible to find the field where the table is used quickly.

Example:
// table tx_myextension_domain_model_mymodel1
$fields = [
    'relation_table1_table2' => [
        'label' => 'Some relation from table 1 to table 2',
        'config' => [
            'type' => 'group',
            'allowed' => 'tx_myextension_domain_model_mymodel2',
            'foreign_table' => 'tx_myextension_domain_model_mymodel2', // needed by Extbase
            'MM' => 'tx_myextension_domain_model_mymodel1_mymodel2_mm',
        ],
    ],
];
Copied!

MM_match_fields

MM_match_fields
Type
array
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Scope
Proc.

In a MM bidirectional relation using group match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

prepend_tname

prepend_tname
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Will prepend the table name to the stored relations (so instead of storing "23" you will store e.g. "tt_content_23"). This is automatically turned on if multiple different tables are allowed for one relation.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The minimum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

suggestOptions

suggestOptions
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Optional, additional suggest options used if the suggest wizard is not hidden. The suggest wizard options can also be overriden on a page TSconfig level.

Suggestions can be configured differently for each table. Settings in "default" are applied to all tables. In the example below, there is a special setting for the "pages" table to search only standard pages.

'related_records' => [
    'label' => 'Related records',
    'config' => [
        'type' => 'group',
        'allowed' => 'pages, tt_content',
        'suggestOptions' => [
            'default' => [
                'searchWholePhrase' => 1
            ],
            'pages' => [
                'searchCondition' => 'doktype = 1'
            ]
        ]
    ]
],
Copied!
additionalSearchFields (string)
Comma-separated list of fields the suggest wizard should also search in. By default the wizard looks only in the fields listed in the label and label_alt of TCA ctrl properties.
addWhere (string)

Allows to define an additional where clause for the searchquery. It supplies a marker for ###THIS_UID### which is useful to exclude the current record.

cssClass (string)
Add a CSS class to every list item of the result list.
maxItemsInResultList (integer)
Maximum number of results to display, default is 10.
maxPathTitleLength (integer)
Maximum number of characters to display when a path element is too long.
minimumCharacters (integer)
Minimum number of characters needed to start the search. Works only in "default" configuration array.
orderBy (string)
Allows to add an ORDER BY part to the search query.
pidList (list of values)

Limit the search to certain pages (and their sub pages). When pidList is empty all pages will be included in the search (as long as the be_user is allowed to see them).

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'pidList' => '1,2,3,45',
         ],
      ],
   ],
],
Copied!
pidDepth (integer)

Expand pidList by this number of levels. Has an effect only if pidList has a value.

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'pidList' => '6,7',
            'pidDepth' => 4
         ],
      ],
   ],
],
Copied!
receiverClass (string)
PHP class alternative receiver class, default is TYPO3\\CMS\\Backend\\Form\\Wizard\\SuggestWizardDefaultReceiver. Can be used to implement an own search strategy.
renderFunc (string)
User function to manipulate the displayed records in the results.
searchCondition (string)

Additional WHERE clause (not prepended with AND).

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         // configures the suggest wizard for the field "storage_pid"
         // in table "pages" to search only for pages with doktype=1
         'pages' => [
            'searchCondition' => 'doktype=1',
         ],
      ],
   ],
],
Copied!
searchWholePhrase (boolean)

Whether to do a LIKE=%mystring% (searchWholePhrase = 1) or a LIKE=mystring% (to do a real find as you type), default is 0.

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'searchWholePhrase' => 1,
         ],
      ],
   ],
],
Copied!
Example: Only show pages with doktype=1 in the suggest options
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_10' => [
            'label' => 'group_db_10 allowed=pages size=1',
            'config' => [
                'type' => 'group',
                'allowed' => 'pages',
                'maxitems' => 1,
                'minitems' => 0,
                'size' => 1,
                'suggestOptions' => [
                    'default' => [
                        'additionalSearchFields' => 'nav_title, url',
                        'addWhere' => 'AND pages.doktype = 1',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Examples

Group relation to a single page

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_10' => [
            'label' => 'group_db_10 allowed=pages size=1',
            'config' => [
                'type' => 'group',
                'allowed' => 'pages',
                'maxitems' => 1,
                'minitems' => 0,
                'size' => 1,
                'suggestOptions' => [
                    'default' => [
                        'additionalSearchFields' => 'nav_title, url',
                        'addWhere' => 'AND pages.doktype = 1',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Group relation to be_groups and be_users

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_1' => [
            'label' => 'group_db_1 allowed=be_users,be_groups description',
            'description' => 'field description',
            'config' => [
                'type' => 'group',
                'allowed' => 'be_users,be_groups',
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Stored data values

Since the "group" element allows to store references to multiple elements we might want to look at how these references are stored internally.

Storage methods

There are two main methods for this:

The default and most wide spread method is the comma list.

Reserved tokens

In the comma list the token "," is used to separate the values. In addition the pipe sign "|" is used to separate value from label value when delivered to the interface. Therefore these tokens are not allowed in reference values, not even if the MM method is used.

The "Comma list" method (default)

When storing references as a comma list the values are simply stored one after another, separated by a comma in between (with no space around!). The database field type is normally a varchar, text or blob field in order to handle this.

From the examples above the four Content Elements will be stored as "26,45,49,1" which is the UID values of the records.

Since "db" references can be stored for multiple tables the rule is that uid numbers without a table name prefixed are implicitly from the first table in the allowed table list! Thus the list "26,45,49,1" is implicitly understood as "tt_content_26,tt_content_45,tt_content_49,tt_content_1". That would be equally good for storage, but by default the "default" table name is not prefixed in the stored string. As an example, lets say you wanted a relation to a Content Element and a Page in the same list. That would look like "tt_content_26,pages_123" or alternatively "26,pages_123" where "26" implicitly points to a "tt_content" record given that the list of allowed tables were "tt_content,pages".

The "MM" method

Using the MM method the Database Analyzer creates an intermediate MM table to store the relation data. The database fields in the affected tables only contain the number of records in the relation. You can read more about it here: Auto creation of intermediate MM tables from TCA

Lets take the examples from before and see how they would be stored in an MM table:

uid_local uid_foreign tablename sorting
[uid of the record you are editing] 26 tt_content 1
[uid of the record you are editing] 45 tt_content 2
[uid of the record you are editing] 49 tt_content 3
[uid of the record you are editing] 1 tt_content 4

Or for "tt_content_26,pages_123":

uid_local uid_foreign tablename sorting
[uid of the record you are editing] 26 tt_content 1
[uid of the record you are editing] 123 pages 2

API for getting the reference list

Class \TYPO3\CMS\Core\Database\RelationHandler is designed to transform the stored reference list values into an array where all uids are paired with the right table name. Also, this class will automatically retrieve the list of MM relations. In other words, it provides an API for getting the references from "group" elements into a PHP array regardless of storage method.

Image manipulation

New in version 13.0

The type "imageManipulation" generates a button showing an image cropper in the backend for image files. It is typically only used in FAL relations. The crop information is stored as an JSON array into the field.

The according database field is generated automatically.

Example: A basic image manipulation field

<?php

return [
    // ...
    'columns' => [
        'my_image_manipulation' => [
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.crop',
            'config' => [
                'type' => 'imageManipulation',
            ],
        ],
    ],
];
Copied!

Properties of the TCA column type imageManipulation

Name Type Scope
boolean Proc.
string (list of file extensions) Proc. / Display
array Proc. / Display
array fieldControl
array
array
array
string (field name) Proc. / Display
boolean Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$imageManipulationField = [
    'config' => [
        'type' => 'imageManipulation',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

allowedExtensions

allowedExtensions
Type
string (list of file extensions)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

List of image types (by file extension) which can be cropped. Defaults to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] which is usually gif,jpg,jpeg,png.

cropVariants

cropVariants
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

Main crop, focus area and cover area configuration. For details see Image manipulation: Crop variants.

fieldControl

fieldControl

The field of type imageManipulation can enable all common field control options. Furthermore the following are available:

elementBrowser

elementBrowser
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl

The element browser field control used in type='imageManipulation' renders a button to open an element browser to choose a imageManipulation.

It is enabled by default if rendering a imageManipulation element.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

file_field

file_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

Name of the database field that contains the uid of the file record. By default set to uid_local.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

Image manipulation: Crop variants

If no cropVariants are configured, the following default configuration is used:

<?php

$defaultCropVariants = [
    'default' => [
        'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.crop_variant.default',
        'allowedAspectRatios' => [
            '16:9' => [
                'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.16_9',
                'value' => 16 / 9,
            ],
            '3:2' => [
                'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.3_2',
                'value' => 3 / 2,
            ],
            '4:3' => [
                'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                'value' => 4 / 3,
            ],
            '1:1' => [
                'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.1_1',
                'value' => 1.0,
            ],
            'NaN' => [
                'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                'value' => 0.0,
            ],
        ],
        'selectedRatio' => 'NaN',
        'cropArea' => [
            'x' => 0.0,
            'y' => 0.0,
            'width' => 1.0,
            'height' => 1.0,
        ],
    ],
];
Copied!

Define multiple crop variants

It is possible to define multiple crop variants. The array key is used as identifier for the ratio and the label is specified with the "title" and the actual (floating point) ratio with the "value" key. The value must be of PHP type float, not only a string.

<?php

$multipleCropVariantField = [
    'label' => 'Field with multiple crop variants',
    'config' => [
        'type' => 'imageManipulation',
        'cropVariants' => [
            'mobile' => [
                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                'allowedAspectRatios' => [
                    '4:3' => [
                        'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                        'value' => 4 / 3,
                    ],
                    'NaN' => [
                        'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                        'value' => 0.0,
                    ],
                ],
            ],
            'desktop' => [
                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.desktop',
                'allowedAspectRatios' => [
                    '4:3' => [
                        'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                        'value' => 4 / 3,
                    ],
                    'NaN' => [
                        'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                        'value' => 0.0,
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Define initial crop area

It is also possible to define an initial crop area. If no initial crop area is defined, the default selected crop area will cover the complete image. Crop areas are defined relatively with floating point numbers. The x and y coordinates and width and height must be specified for that. The below example has an initial crop area in the size the previous image cropper provided by default.

<?php

$myCropVariantField = [
    'label' => 'Crop variant field',
    'config' => [
        'type' => 'imageManipulation',
        'cropVariants' => [
            'mobile' => [
                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                'cropArea' => [
                    'x' => 0.1,
                    'y' => 0.1,
                    'width' => 0.8,
                    'height' => 0.8,
                ],
            ],
        ],
    ],
];
Copied!

Add a focus area

Users can also select a focus area, when configured. The focus area is always inside the crop area and marks the area in the image which must be visible for the image to transport its meaning. The selected area is persisted to the database but will have no effect on image processing. The data points are however made available as data attribute when using the <f:image /> view helper.

The below example adds a focus area, which is initially one third of the size of the image and centered.

<?php

$myCropVariantField = [
    'label' => 'Crop variant field',
    'config' => [
        'type' => 'imageManipulation',
        'cropVariants' => [
            'mobile' => [
                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                'focusArea' => [
                    'x' => 1 / 3,
                    'y' => 1 / 3,
                    'width' => 1 / 3,
                    'height' => 1 / 3,
                ],
            ],
        ],
    ],
];
Copied!

Define cover areas

Very often images are used in a context, where they are overlaid with other DOM elements, like a headline. To give editors a hint which area of the image is affected, when selecting a crop area, it is possible to define multiple so called cover areas. These areas are shown inside the crop area. The focus area cannot intersect with any of the cover areas.

<?php

$myCropVariantField = [
    'label' => 'Crop variant field',
    'config' => [
        'type' => 'imageManipulation',
        'cropVariants' => [
            'mobile' => [
                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                'coverAreas' => [
                    [
                        'x' => 0.05,
                        'y' => 0.85,
                        'width' => 0.9,
                        'height' => 0.1,
                    ],
                ],
            ],
        ],
    ],
];
Copied!

The above configuration examples are basically meant to add one single cropping configuration to sys_file_reference, which will then apply in every record, which reference images.

Configuration per content element

It is however also possible to provide a configuration per content element. If you for example want a different cropping configuration for tt_content images, then you can add the following to your image field configuration of tt_content records:

<?php

$myCropVariantField = [
    'label' => 'Crop variant field',
    'config' => [
        'overrideChildTca' => [
            'columns' => [
                'crop' => [
                    'config' => [
                        'cropVariants' => [
                            'mobile' => [
                                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                                'cropArea' => [
                                    'x' => 0.1,
                                    'y' => 0.1,
                                    'width' => 0.8,
                                    'height' => 0.8,
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Please note, that you need to specify the target column name as array key. Most of the time this will be crop as this is the default field name for image manipulation in sys_file_reference

Define a cropping configuration for a specific content element

It is also possible to set the cropping configuration only for a specific tt_content element type by using the columnsOverrides feature:

<?php

$myCropVariantField = [
    'label' => 'Crop variant field',
    'config' => [
        'overrideChildTca' => [
            'columns' => [
                'crop' => [
                    'config' => [
                        'cropVariants' => [
                            'mobile' => [
                                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                                'cropArea' => [
                                    'x' => 0.1,
                                    'y' => 0.1,
                                    'width' => 0.8,
                                    'height' => 0.8,
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Please note, that the array for overrideChildTca is merged with the child TCA, so are the crop variants that are defined in the child TCA (most likely sys_file_reference). Because you cannot remove crop variants easily, it is possible to disable them for certain field types by setting the array key for a crop variant disabled to the value true

Disable an aspect ratio

Not only cropVariants but also aspect ratios can be disabled by adding a "disabled" key to the array.

<?php

$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config'] = [
    'cropVariants' => [
        'default' => [
            'allowedAspectRatios' => [
                '4:3' => [
                    'disabled' => true,
                ],
            ],
        ],
    ],
];
Copied!

This works for each field, that defines cropVariants for any sys_file_reference usage.

Crop variants in ViewHelpers

To render crop variants, the variants can be specified as argument to the image ViewHelpers:

<f:image image="{data.image}" cropVariant="mobile" width="800" />
Copied!

IRRE / inline

New in version 13.0

Inline Relational Record Editing (IRRE) is a way of editing parent-child-relations in the backend view. Instead of child records already having to exist, new child records are created using AJAX calls (to prevent reloading the complete backend view).

The according database field is generated automatically.

The type='inline' is a powerful element that can handle many types of relation, including simple 1:n and nested 1:n-1:n relations, aswell as m:n relations with different view aspects and localization setups. When combined with 'ctrl' and 'types' properties in the TCA a huge amount of different views are possible.

The inline type was mainly designed to handle 1:n relations, where one parent record has many children and each child has only one parent. Children can not be transferred from one parent to another.

However, m:n relations can be setup using intermediate tables. An m:n relation is where a child has many parents. In addition to the main parent-child relation fields in the intermediate table, fields can be added to attach additional information to the parent-child relation. One example of this is "FAL" / resource handling in the Core. A parent record (for instance table "tt_content") is connected via table "sys_file_reference" to a media resource in "sys_file". A sys_file record has table "sys_file_metadata" as a child record which holds meta information about the file (for instance a description). This information can be overwritten for the specific file resource used in "tt_content" by adding a new description in "sys_file_reference". There are inline and field properties in the TCA such as "placeholder" to set this up.

Properties of the TCA column type inline

Name Type Scope
array Display
integer Display
boolean Proc.
boolean Proc.
boolean Proc.
array Display
array Display / Proc.
string Display
string Display / Proc.
string Display / Proc.
array Proc.
string Display / Proc.
string Display / Proc.
string (table name) Display / Proc.
string Display / Proc.
string Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
string (field name) Proc.
array Display
integer Display
string Display / Proc.
string Display / Proc.
string Display / Proc.

appearance

appearance
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Has information about the appearance of child records, namely:

collapseAll (boolean)
Show all child records collapsed (if false, all are expanded)
expandSingle (boolean)
Show only one child record expanded each time. If a collapsed record is clicked, the currently open one collapses and the clicked one expands.
showNewRecordLink (boolean)
Disables the New record link in TCA inline elements without simultaneously disabling the + button in the header of each inline record (using ['appearance']['enabledControls']['new']).
newRecordLinkAddTitle (boolean)

Adds the title of the foreign_table to the "New record" link.

false
"Create new"
true
"Create new <title of foreign_table>", e.g. "Create new address"
newRecordLinkTitle (string or LLL reference)

Overrides the title of the "New record" link with a localized string. This will work only if newRecordLinkAddTitle is not set to true.

Example:

'newRecordLinkTitle' => 'LLL:EXT:myext/Resources/Private/Language/locallang_db.xlf:my_new_record_label'
Copied!
createNewRelationLinkTitle (string or LLL reference)
Overrides the link text and title of the "Create new relation" button with a localised string. Only useful, if the element browser is enabled. This is usually used together with FAL relations to change it to "Add file" or similar.
levelLinksPosition (string)
Values: 'top' (default), 'bottom', 'both'. Defines where to show the "New record" link in relation to the child records. Value 'none' is no longer supported, use showAllLocalizationLink, showSynchronizationLink and showNewRecordLink with value false instead.
useCombination (boolean)
This is only useful on bidirectional relations using an intermediate table with attributes. In a "combination" it is possible to edit the attributes AND the related child record itself. If using a foreign_selector in such a case, the foreign_unique property must be set to the same field as the foreign_selector.
suppressCombinationWarning (boolean)

Suppresses the warning flash message that will be displayed when using useCombination. You can also override the message with your own message using the example below.

Example:

$GLOBALS['TCA']['tx_demo_domain_model_demoinline']['columns']['irre_records']['config'] = [
     'appearance' => [
        'overwriteCombinationWarningMessage' => 'LLL:EXT:demo/Resources/Private/Language/locallang_db.xlf:tx_demo_domain_model_demoinline.irre_records.useCombinationWarning',
        'useCombination' => TRUE
     ],
],
Copied!
useSortable (boolean)
Activate drag & drop.
showPossibleLocalizationRecords (boolean)
Show unlocalized records which are in the original language, but not yet localized.
showAllLocalizationLink (boolean)
Defines whether to show the "localize all records" link to fetch untranslated records from the original language.
showSynchronizationLink (boolean)
Defines whether to show a "synchronize" link to update to a 1:1 translation with the original language.
enabledControls (array)
Associative array with the keys 'info', 'new', 'dragdrop', 'sort', 'hide', 'delete', 'localize'. If the accordant values are set to a boolean value (true or false), the control is shown or hidden in the header of each record.
showPossibleRecordsSelector (boolean)
Can be used to hide the foreign record selector from the interface, even if you have a foreign_selector configured. This can be used to keep the technical functionality of the foreign_selector but is useful if you want to replace it with your own implementation using a custom control, see customControls.
elementBrowserEnabled (boolean)
Hides or displays the element browser button in inline records

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$inlineField = [
    'config' => [
        'type' => 'inline',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

disableMovingChildrenWithParent

disableMovingChildrenWithParent
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']
Scope
Proc.

Default false. Disables that child records get moved along with their parent records. Usually if in a parent-child relation a parent record is moved to a different page (eg. via cut+paste from clipboard), the children are relocated along with the parent. This flag disables the child move.

This property can be especially useful if all child records should be gathered in one storage folder and their parents are spread out at different places in the page tree. In combination with the Tsconfig setting TCAdefaults.<table>.pid = <page id> children can be forced to be created in this folder and stay there.

enableCascadingDelete

enableCascadingDelete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']
Scope
Proc.

Default true. Usually in inline relations, if a parent is deleted, all children are deleted along with the parent. This flag can be used to disable that cascading delete. Example usage: A frontend user (parent) has assigned invoices (children). If a frontend user is deleted, it could be useful to keep the invoices.

customControls

customControls
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Numerical array containing definitions of custom header controls for IRRE fields. This makes it possible to create special controls by calling user-defined functions (userFuncs). Each item in the array item must be an array itself, with at least on key "userFunc" pointing to the user function to call.

The userFunc string is defined as usual in TYPO3 as ['class']->['method'], e.g.:

\Vendor\Extension\MyClass::class . '->myUserFuncMethod'
Copied!

For more details, see the implementation in TYPO3\\CMS\\Backend\\Form\\Container\\InlineControlContainer and search for "customControls".

filter

filter
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Possibility to define user functions to filter out child items.

This is useful in special scenarios when used in conjunction with a foreign_selector where only certain foreign records are allowed to be related to.

For further documentation on this feature, see the "filter" documentation under TYPE: "group".

foreign_default_sortby

foreign_default_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

If a field name for foreign_sortby is defined, then this is ignored. Otherwise, this is used as the "ORDER BY" statement to sort the records in the table when listed.

foreign_field

foreign_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

The foreign_field is the field of the child record pointing to the parent record. This defines where to store the uid of the parent record.

foreign_label

foreign_label
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Insert the fieldname of the inline element, that you want to have as the title of the inline element. E.g. 'header'. If set, it overrides the label set in $GLOBALS['TCA'][<foreign_table>]['ctrl']['label'] for the inline-view.

foreign_match_fields

foreign_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Array of field-value pairs to both insert and match against when writing/reading IRRE relations. Using the match fields, it is possible to re-use the same child table in more than one field of the parent table by using a match field with different values for each of the use cases.

Examples

Imagine you have a parent table called "company" and a child table called "persons". Now, if you want the company table to have two fields of type "inline", one called "employees" and one called "customers", both containing "persons". Then you could use a (hidden) field called "role" on the child (person) table to keep them apart. The match TCA configuration of the parent table would then look like this:

<?php

$GLOBALS['TCA']['ty_myext_company'] = [
    'columns' => [
        'employees' => [
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'ty_myext_person',
                'foreign_field' => 'company',
                'foreign_match_fields' => [
                    'role' => 'employee',
                ],
            ],
        ],
        'customers' => [
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'ty_myext_person',
                'foreign_field' => 'company',
                'foreign_match_fields' => [
                    'role' => 'customer',
                ],
            ],
        ],
    ],
];
Copied!

If the match field is made editable, for instance as a select drop-down of two values, the the relation would switch between the two parent fields after change an save. Imagine a user record having "open" and "closed" issues assigned, both pointing to the same table. The user then switches the status of an issue from "open" to "closed". On save, the issue would "move over" to the "closed" section in his view.

foreign_selector

foreign_selector
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

A selector is used to show all possible child records that could be used to create a relation with the parent record. It will be rendered as a multi-select-box. On clicking on an item inside the selector a new relation is created. The foreign_selector points to a field of the foreign_table that is responsible for providing a selector-box – this field on the foreign_table usually is of type select and also has a foreign_table defined.

In most cases you must assign the field uid_local to the foreign_selector. This field name is used as a convention for the child record of the intermediate table. The automatic generation of MM tables also uses this field name. It depends whether uid_local of the MM table points to the opposite table (of the perspective of your inline field). In case of the opposite direction the field name uid_foreign is usually used.

foreign_sortby

foreign_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Define a field on the child record that stores the manual sorting information. It is possible to have a different sorting, depending from which side of the relation we look at parent or child.

This property requires that the foreign_field approach is used.

When using MM relations the field used on the intermediate table is hardcoded to sorting_foreign. Setting this property has no effect combined with an MM table.

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Required
true
Scope
Display / Proc.

The table name of the child records is defined here. The table must be configured in $GLOBALS['TCA'] .

foreign_table_field

foreign_table_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

The foreign_table_field is the field of the child record pointing to the parent record. This defines where to store the table name of the parent record. On setting this configuration key together with foreign_field, the child record knows what its parent record is – so the child record could also be used on other parent tables. This issue is also known as "weak entity". Do not confuse with foreign_table or foreign_field. It has its own behavior.

foreign_unique

foreign_unique
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Field which must be unique for all children of a parent record.

Example

Say you have two tables, products, your parent table, and prices, your child table (products) can have multiple prices. The prices table has a field called customer_group, which is a selector box. Now you want to be able to specify prices for each customer group when you edit a product, but of course you don't want to specify contradicting prices for one product (i.e. two different prices for the same customer_group). That's why you would set foreign_unique to the field name "customer_group", to prevent that two prices for the same customer group can be created for one product.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store an MM relation. It is used together with foreign_table. The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

Example: Inline field with MM table configured
An inline field with MM relation
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mm.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mm_child',
                'MM' => 'tx_styleguide_inline_mm_child_rel',
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!
Example: Opposite field to display MM relations two ways
An inline field with MM relation
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mm_child.php
[
    'columns' => [
        'parents' => [
            'label' => 'parents',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mm',
                'MM' => 'tx_styleguide_inline_mm_child_rel',
                'MM_opposite_field' => 'inline_1',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!

overrideChildTca

overrideChildTca
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

This property can be used to override certain aspects of the child's TCA if that child record is opened inline of the given parent. Display related TCA properties of the child table can be overridden in types and columns section.

See also Examples with overrideChildTca.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Only useful in combination with foreign_selector.

If set to 1 (default), the combination box is a select drop-down, else a select box of given size.

symmetric_field

symmetric_field
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

This works like foreign_field, but in case of using bidirectional symmetric relations. symmetric_field defines in which field on the foreign_table the uid of the "other" parent is stored.

Example
EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric.php
[
    'columns' => [
        'branches' => [
            'label' => 'branches',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mnsymmetric_mm',
                'foreign_field' => 'hotelid',
                'foreign_sortby' => 'hotelsort',
                'foreign_label' => 'branchid',
                'symmetric_field' => 'branchid',
                'symmetric_sortby' => 'branchsort',
                'symmetric_label' => 'hotelid',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!

symmetric_label

symmetric_label
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

If set, it overrides the label set in $GLOBALS['TCA'][<foreign_table>]['ctrl']['label'] for the inline-view and only if looking to a symmetric relation from the "other" side.

symmetric_sortby

symmetric_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

This works like foreign_sortby, but in case of using bidirectional symmetric relations. Each side of a symmetric relation could have its own sorting, so symmetric_sortby defines a field on the foreign_table where the sorting of the "other" side is stored. This property requires that the foreign_field approach is used.

Examples

Simple 1:n relation

This combines a table (for example companies) with a child table (for example employees).

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_1n.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_1n_inline_1_child',
                'foreign_field' => 'parentid',
                'foreign_table_field' => 'parenttable',
                'appearance' => [
                    'showSynchronizationLink' => true,
                    'showAllLocalizationLink' => true,
                    'showPossibleLocalizationRecords' => true,
                ],
            ],
        ],
    ],
]
Copied!

Attributes on anti-symmetric intermediate table

The record has two child records displayed inline.

This example combines records from a parent table tx_styleguide_inline_mn with records from the child table tx_styleguide_inline_mn_child using the intermediate table tx_styleguide_inline_mn_mm. It is also possible to add attributes to every relation – in this example a checkbox.

The parent table tx_styleguide_inline_mn contains the following column:

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mn.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mn_mm',
                'foreign_field' => 'parentid',
                'foreign_sortby' => 'parentsort',
                'foreign_label' => 'childid',
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!

If the child table tx_styleguide_inline_mn_child wants to display its parents also it needs to define a column like in this example:

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mn_child.php
[
    'columns' => [
        'parents' => [
            'label' => 'parents',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mn_mm',
                'foreign_field' => 'childid',
                'foreign_sortby' => 'childsort',
                'foreign_label' => 'parentid',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!

The intermediate table tx_styleguide_inline_mn_mm defines the following fields:

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mn_mm.php
return [
   'columns' => [
      'parentid' => [
         'label' => 'parentid',
         'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'foreign_table' => 'tx_styleguide_inline_mn',
            'foreign_table_where' => 'AND {#tx_styleguide_inline_mn}.{#pid}=###CURRENT_PID### AND {#tx_styleguide_inline_mn}.{#sys_language_uid}=\'###REC_FIELD_sys_language_uid###\'',
            'maxitems' => 1,
            'localizeReferences' => 1,
         ],
      ],
      'childid' => [
         'label' => 'childid',
         'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'foreign_table' => 'tx_styleguide_inline_mn_child',
            'foreign_table_where' => 'AND {#tx_styleguide_inline_mn_child}.{#pid}=###CURRENT_PID### AND {#tx_styleguide_inline_mn_child}.{#sys_language_uid}=\'###REC_FIELD_sys_language_uid###\'',
            'maxitems' => 1,
            'localizeReferences' => 1,
         ],
      ],
      'parentsort' => [
         'config' => [
            'type' => 'passthrough',
         ],
      ],
      'childsort' => [
         'config' => [
            'type' => 'passthrough',
         ],
      ],
   ]
];
Copied!

Attributes on symmetric intermediate table

Record 1 is related to records 6 and 11 of the same table

This example combines records of the same table with each other. Image we want to store relationships between hotels. Symmetric relations combine records of one table with each other. If record A is related to record B then record B is also related to record A. However, the records are not stored in groups. If record A is related to B and C, B doesn't have to be related to C.

Record 11 is symmetrically related to record 1 but not to 6

The main table tx_styleguide_inline_mnsymmetric has a field storing the inline relation, here: branches.

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric.php
[
    'columns' => [
        'branches' => [
            'label' => 'branches',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_mnsymmetric_mm',
                'foreign_field' => 'hotelid',
                'foreign_sortby' => 'hotelsort',
                'foreign_label' => 'branchid',
                'symmetric_field' => 'branchid',
                'symmetric_sortby' => 'branchsort',
                'symmetric_label' => 'hotelid',
                'maxitems' => 10,
                'appearance' => [
                    'showSynchronizationLink' => 1,
                    'showAllLocalizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                ],
            ],
        ],
    ],
]
Copied!

Records of the main table can than have a symmetric relationship to each other using the intermediate table tx_styleguide_inline_mnsymmetric_mm.

The intermediate table stores the uids of both sides of the relation in hotelid and branchid. Furthermore custom sorting can be defined in both directions.

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric_mm.php
[
   'columns' => [
      'input_1' => [
         'exclude' => 1,
         'l10n_mode' => 'prefixLangTitle',
         'label' => 'input_1',
         'config' => [
            'type' => 'input',
            'size' => '30',
            'eval' => 'required',
         ],
      ],
      'branches' => [
         'exclude' => 1,
         'label' => 'branches',
         'config' => [
            'type' => 'inline',
            'foreign_table' => 'tx_styleguide_inline_mnsymmetric_mm',
            'foreign_field' => 'hotelid',
            'foreign_sortby' => 'hotelsort',
            'foreign_label' => 'branchid',
            'symmetric_field' => 'branchid',
            'symmetric_sortby' => 'branchsort',
            'symmetric_label' => 'hotelid',
            'maxitems' => 10,
            'appearance' => [
               'showSynchronizationLink' => 1,
               'showAllLocalizationLink' => 1,
               'showPossibleLocalizationRecords' => 1,
            ],
         ],
      ],
   ],
];
Copied!

With a combination box

The combination box shows available records. On clicking one entry it gets added to the parent record.

EXT:styleguide/Configuration/TCA/tx_styleguide_inline_usecombination.php
[
    'columns' => [
        'inline_1' => [
            'label' => 'inline_1',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_styleguide_inline_usecombination_mm',
                'foreign_field' => 'select_parent',
                'foreign_selector' => 'select_child',
                'foreign_unique' => 'select_child',
                'maxitems' => 9999,
                'autoSizeMax' => 10,
                'appearance' => [
                    'newRecordLinkAddTitle' => 1,
                    'useCombination' => true,
                    'collapseAll' => false,
                    'levelLinksPosition' => 'top',
                    'showSynchronizationLink' => 1,
                    'showPossibleLocalizationRecords' => 1,
                    'showAllLocalizationLink' => 1,
                ],
            ],
        ],
    ],
]
Copied!

Add a custom fieldInformation

We show a very minimal example which adds a custom fieldInformation for the inline type in tt_content. Adding a fieldWizard is done in a similar way.

As explained in the description, fieldInformation or fieldWizard must be configured within the ctrl for the field type inline - as it is a container.

  1. Create a custom fieldInformation

    EXT:my_extension/Classes/FormEngine/FieldInformation/DemoFieldInformation.php
    <?php
    
    declare(strict_types=1);
    
    namespace Myvendor\Myexample\FormEngine\FieldInformation;
    
    use TYPO3\CMS\Backend\Form\AbstractNode;
    
    class DemoFieldInformation extends AbstractNode
    {
        public function render(): array
        {
            $fieldName = $this->data['fieldName'];
            $result = $this->initializeResultArray();
    
            // Add fieldInformation only for this field name
            //   this may be changed accordingly
            if ($fieldName !== 'my_new_field') {
                return $result;
            }
    
            $text = $GLOBALS['LANG']->sL(
                'LLL:EXT:my_example/Resources/Private/Language/'
                . 'locallang_db.xlf:tt_content.fieldInformation.demo'
            );
    
            $result['html'] = $text;
            return $result;
        }
    }
    
    Copied!
  2. Register this node type

    EXT:my_extension/ext_localconf.php
    <?php
    
    use Myvendor\Myexample\FormEngine\FieldInformation\DemoFieldInformation;
    
    // ...
    
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1654355506] = [
        'nodeName' => 'demoFieldInformation',
        'priority' => 30,
        'class' => DemoFieldInformation::class,
    ];
    
    Copied!
  3. Add the fieldInformation to the container for containerRenderType inline

    EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
    <?php
    
    $GLOBALS['TCA']['tt_content']['ctrl']['container']['inline']['fieldInformation'] = [
        'demoFieldInformation' => [
            'renderType' => 'demoFieldInformation',
        ],
    ];
    
    Copied!
  4. A field my_new_field is created in the tt_content TCA:

    EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
    <?php
    
    $tempFields = [
        'my_new_field2' => [
            'label' => 'inline field with field information',
            'config' => [
                'type' => 'inline',
                // further configuration can be found in the examples above
                // ....
            ],
        ],
    ];
    
    Copied!

Examples with overrideChildTca

Overrides the crop variants

This example overrides the crop variants in a configured fal relation:

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

$GLOBALS['TCA']['tt_content']['columns']['assets'] = [
    'config' => [
        'overrideChildTca' => [
            'columns' => [
                'crop' => [
                    'config' => [
                        'cropVariants' => [
                            'default' => [
                                'disabled' => true,
                            ],
                            'mobile' => [
                                'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                                'cropArea' => [
                                    'x' => 0.1,
                                    'y' => 0.1,
                                    'width' => 0.8,
                                    'height' => 0.8,
                                ],
                                'allowedAspectRatios' => [
                                    '4:3' => [
                                        'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                                        'value' => 4 / 3,
                                    ],
                                    'NaN' => [
                                        'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                                        'value' => 0.0,
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Define which fields to show in the child table

This example overrides the showitem field of the child table TCA:

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

$GLOBALS['TCA']['tt_content']['columns']['anInlineField'] = [
    'config' => [
        'type' => 'inline',
        'overrideChildTca' => [
            'types' => [
                'aForeignType' => [
                    'showitem' => 'aChildField',
                ],
            ],
        ],
    ],
];
Copied!

Override the default value of a child tables field

This overrides the default columns property of a child field in an inline relation from within the parent if a new child is created:

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

$GLOBALS['TCA']['tt_content']['columns']['anInlineField'] =  [
    'config' => [
        'type' => 'inline',
        'overrideChildTca' => [
            'columns' => [
                'CType' => [
                    'config' => [
                        'default' => 'image',
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Override the foreign_selector field target

This overrides the foreign_selector field target field config, defined in the foreign_selector property. This is used in FAL inline relations:

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

$allowedFileExtensions = 'png,svg';

$GLOBALS['TCA']['tt_content']['columns']['anInlineField'] = [
    'config' => [
        'type' => 'inline',
        'foreign_selector' => 'uid_local',
        'overrideChildTca' => [
            'columns' => [
                'uid_local' => [
                    'config' => [
                        'appearance' => [
                            'elementBrowserType' => 'file',
                            'elementBrowserAllowed' => $allowedFileExtensions,
                        ],
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Example: Override by type

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

$allowedFileExtensions = 'png,svg';

$GLOBALS['TCA']['tt_content']['columns']['anInlineField'] = [
    'config' => [
        'type' => 'inline',
        'foreign_selector' => 'uid_local',
        'overrideChildTca' => [
            'columns' => [
                'uid_local' => [
                    'config' => [
                        'appearance' => [
                            'elementBrowserType' => 'file',
                            'elementBrowserAllowed' => $allowedFileExtensions,
                        ],
                    ],
                ],
            ],
        ],
    ],
];
Copied!

Input

type='input' generates a html <input> field with the type attribute set to text. It is possible to apply additional features such as the valuePicker.

The according database field is generated automatically. For short input fields allowing less than 255 chars VARCHAR() is used, TEXT for larger input fields.

Extension authors who need or want to override default TCA schema details for whatever reason, can of course do so by defining something specific in ext_tables.sql.

Changed in version 13.2

Tables with TCA columns set to type="input" do not need an ext_tables.sql entry anymore. The Core now creates this column automatically.

Examples

Simple input field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'input_1' => [
            'l10n_mode' => 'prefixLangTitle',
            'label' => 'input_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'input',
                'behaviour' => [
                    'allowLanguageSynchronization' => true,
                ],
            ],
        ],
    ],
]
Copied!

Input with placeholder and null handling

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'input_28' => [
            'label' => 'input_28',
            'description' => 'placeholder=__row|input_26 mode=useOrOverridePlaceholder nullable=true default=null',
            'config' => [
                'type' => 'input',
                'placeholder' => '__row|input_26',
                'nullable' => true,
                'default' => null,
                'mode' => 'useOrOverridePlaceholder',
            ],
        ],
    ],
]
Copied!

Value picker

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'input_33' => [
            'label' => 'input_33',
            'description' => 'valuePicker',
            'config' => [
                'type' => 'input',
                'size' => 20,
                'eval' => 'trim',
                'valuePicker' => [
                    'items' => [
                        [
                            'spring',
                            'Spring',
                        ],
                        [
                            'summer',
                            'Summer',
                        ],
                        [
                            'autumn',
                            'Autumn',
                        ],
                        [
                            'winter',
                            'Winter',
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type input

Name Type Scope
boolean Proc.
boolean Display
string Display / Proc.
string (list of keywords) Display / Proc.
array
array
array
string Display / Proc.
integer Display
integer Display
string (keywords) Display
boolean Proc
string Display
boolean Display
boolean Display / Proc.
array Search
boolean
boolean
string
integer Display
string Proc.
array Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$inputField = [
    'config' => [
        'type' => 'input',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

autocomplete

autocomplete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Controls the autocomplete attribute of a given input field. If set to true (default false), adds attribute autocomplete="on" to the input field allowing browser auto filling the field:

'title' => [
    'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.title',
    'config' => [
        'type' => 'input',
        'size' => 20,
        'nullable' => true,
        'autocomplete' => true
    ]
],
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no input gets selected.

eval

eval
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Configuration of field evaluation. See also Input fields with eval.

Some of these evaluation keywords will trigger a JavaScript pre- evaluation in the form. Other evaluations will be performed in the backend. The evaluation functions will be executed in the list-order. Keywords:

alpha
Allows only a-zA-Z characters.
alphanum
Same as "alpha" but allows also "0-9"
alphanum_x
Same as "alphanum" but allows also "_" and "-" chars.
domainname
Allows a domain name such as example.org and automatically transforms the value to punicode if needed.
is_in
Will filter out any character in the input string which is not found in the string entered in the property is_in.
lower
Converts the string to lowercase (only A-Z plus a selected set of Western European special chars).
md5
Will convert the input value to its md5-hash using a JavaScript function.
nospace
Removes all occurrences of space characters (chr(32))
num
Allows only 0-9 characters in the field.
trim
The value in the field will have white spaces around it trimmed away.
unique

Requires the field to be unique for the whole table. Evaluated on the server only.

uniqueInPid
Requires the field to be unique for the current PID among other records on the same page. Evaluated on the server only.
upper
Converts to uppercase (only A-Z plus a selected set of Western European special chars).
year
Evaluates the input to a year between 1970 and 2038. If you need any year, then use "int" evaluation instead.
Vendor\Extension\*
User defined form evaluations.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

is_in

is_in
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

If the evaluation type "is_in" (see eval) is used for evaluation, then the characters in the input string should be found in this string as well. This value is also passed as argument to the evaluation function if a user-defined evaluation function is registered.

max

max
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Value for the "maxlength" attribute of the <input> field. Javascript prevents adding more than these number of characters.

If the form element edits a varchar(40) field in the database you should also set this value to 40.

min

min
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

This option allows to define a minimum number of characters for the <input> field and adds a minlength attribute to the field. If at least one character is typed in and the number of characters is less than min, the FormEngine marks the field as invalid, preventing the user to save the element. DataHandler will also take care for server-side validation and reset the value to an empty string, if min is not reached.

When using min in combination with , one has to make sure, the min value is less than or equal max. Otherwise the option is ignored.

Empty fields are not validated. If one needs to have non-empty values, it is recommended to use required => true in combination with min.

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The database field must allow the NULL value.

Example: A nullable field
EXT:some_extension/Configuration/TCA/tx_sometable.php
'columns' => [
     'nullable_column' => [
          'title' => 'A nullable field',
          'config' => [
                'type' => 'input',
                'nullable' => true,
                'eval' => 'trim',
          ],
     ],
],
Copied!

placeholder

placeholder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a default value.

EXT:my_extension/Configuration/TCA/Overrides/some-table.php
<?php

$temporaryColumns['ainputField'] = [
    'title' => 'My input field',
    'config' => [
        'type' => 'input',
        'placeholder' => '#FF8700',
        'mode' => 'useOrOverridePlaceholder',
    ],
];
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

search

Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
Scope
Search

Defines additional search-related options for a given field.

pidonly

pidonly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']

Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.

case

case
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']

Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.

andWhere

andWhere
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']

Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched

EXT:some_extension/Configuration/TCA/tx_sometable.php
$temporaryColumns['some_date'] => [
    'config' => [
        'search' => [
            'andWhere' => '{#CType}=\'type_x\' OR {#CType}=\'type_y\'',
        ],
        // ...
    ],
];
Copied!

This means that the "some_date" field of the "tt_content" table will be searched in only for elements of type X and Y. This helps making any search more relevant.

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the input field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

softref

softref
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
input

Used to attach "soft reference parsers".

The syntax for this value is key1,key2[parameter1;parameter2;...],...

See Soft references of core API for more details about softref keys.

valuePicker

valuePicker
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders a select box with static values next to the input field. When a value is selected in the box, the value is transferred to the field. Keys:

mode (keyword)
blank (or not set)
The selected value substitutes the value in the input field
append
The selected value is appended to an existing value of the input field
prepend
The selected value is prepended to an existing value of the input field
items (array)
An array with selectable items. Each item is an array with the first value being the label in the select drop-down (LLL reference possible) the second being the value transferred to the input field.
Example: An input field with value picker
'input_33' => [
    'label' => 'input_33',
    'config' => [
        'type' => 'input',
        'valuePicker' => [
            'items' => [
                ['spring', 'Spring'],
                ['summer', 'Summer'],
                ['autumn', 'Autumn'],
                ['winter', 'Winter'],
            ],
        ],
    ],
],
Copied!

Input fields with eval

Trim white space

Trimming the value for white space before storing in the database:

<?php

$aField = [
    'label' => 'aLabel',
    'config' => [
        'type' => 'input',
        'eval' => 'trim',
    ],
];
Copied!

Combine eval rules

By this configuration the field will be stripped for any space characters, converted to lowercase, only accepted if filled in and on the server the value is required to be unique for all records from this table:

'eval' => 'nospace,lower,unique'
Copied!

Custom eval rules

You can supply own form evaluations in an extension by creating a class with three functions, one which returns the JavaScript code for client side validation called returnFieldJS() and two for the server side: deevaluateFieldValue() called when opening the record and evaluateFieldValue() called for validation when saving the record:

EXT:extension/Classes/Evaluation/ExampleEvaluation.php

EXT:my_extension/Classes/EvaluationExampleEvaluation.php
<?php

namespace MVendor\MyExtension\Evaluation;

/**
 * Class for field value validation/evaluation to be used in 'eval' of TCA
 */
class ExampleEvaluation
{
    /**
     * JavaScript code for client side validation/evaluation
     *
     * @return string JavaScript code for client side validation/evaluation
     */
    public function returnFieldJS()
    {
        return 'return value + " [added by JavaScript on field blur]";';
    }

    /**
     * Server-side validation/evaluation on saving the record
     *
     * @param string $value The field value to be evaluated
     * @param string $is_in The "is_in" value of the field configuration from TCA
     * @param bool $set Boolean defining if the value is written to the database or not.
     * @return string Evaluated field value
     */
    public function evaluateFieldValue($value, $is_in, &$set)
    {
        return $value . ' [added by PHP on saving the record]';
    }

    /**
     * Server-side validation/evaluation on opening the record
     *
     * @param array $parameters Array with key 'value' containing the field value from the database
     * @return string Evaluated field value
     */
    public function deevaluateFieldValue(array $parameters)
    {
        return $parameters['value'] . ' [added by PHP on opening the record]';
    }
}
Copied!
EXT:my_extension/ext_localconf.php
<?php

use Vendor\Extension\Evaluation\ExampleEvaluation;

// ....

// Register the class to be available in 'eval' of TCA
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][ExampleEvaluation::class] = '';
Copied!
EXT:extension/Configuration/TCA/tx_example_record.php
<?php

return [
    // ...
    'columns' => [
        'example_field' => [
            'config' => [
                'type' => 'text',
                'required' => true,
                'eval' => 'trim,' . \MyVendor\MyExtension\Evaluation\ExampleEvaluation::class,
            ],
        ],
    ],
];
Copied!

Json

When using the json type, TYPO3 takes care of generating the according database field. A developer does not need to define this field in an extension's ext_tables.sql file.

Example: Simple JSON field

The system extension typo3/cms-webhooks uses a TCA field of type JSON for the input of additional HTTP request header data:

The additional header field with some example input
EXT:webhooks/Configuration/TCA/sys_webhook.php
[
    'columns' => [
        'additional_headers' => [
            'label' => 'LLL:EXT:webhooks/Resources/Private/Language/locallang_db.xlf:sys_webhook.additional_headers',
            'description' => 'LLL:EXT:webhooks/Resources/Private/Language/locallang_db.xlf:sys_webhook.additional_headers.description',
            'config' => [
                'type' => 'json',
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type json

Name Type Scope
boolean Proc.
integer Display
string
boolean
string
string
string
string Display
boolean Display
boolean Display / Proc.
integer Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$jsonField = [
    'config' => [
        'type' => 'json',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

cols

cols
Type
integer
Default
30
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <textarea> field in which the JSON is displayed. To set the textarea to the full width of the form area, use the value 50.

This value can be overridden by page TSconfig.

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']

Default value set if a new record is created.

enableCodeEditor

enableCodeEditor
Type
boolean
Default
true
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['enableCodeEditor']

In case enableCodeEditor is set to true, which is the default and the system extension typo3/cms-t3editor is installed and active, the JSON value is rendered in the corresponding code editor.

Otherwise it is rendered in a standard textarea HTML element.

fieldControl

fieldControl
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']

See fieldControl for details.

fieldInformation

fieldInformation
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldInformation']

See fieldInformation for details.

fieldWizard

fieldWizard
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']

See fieldWizard for details.

placeholder

placeholder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder text for the field.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders the field in a way that the user can see the values but cannot edit them. The rendering is as similar as possible to the normal rendering but may differ in layout and size.

This value can be overridden by page TSconfig.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['required']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

rows

rows
Type
integer
Default
5
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['rows']
Scope
Display

The number of rows in the JSON editor. May be corrected for harmonization between browsers. Will also automatically be increased if the content in the field is found to be of a certain length, thus the field will automatically fit the content. Default is 5. Max value is 20.

This value can be overridden by page TSconfig.

Language fields

New in version 13.0

Changed in version 13.3

This field type displays all languages available in the current site context. Outside of the site context it displays all languages available in the installation.

A special language All languages is automatically added.

The according database field is generated automatically.

EXT:myExtension/Configuration/Overrides/someTable.php
<?php

$GLOBALS['TCA'][$someTable]['columns'][$someLanguageField] = [
    'label' => 'Some language field',
    'config' => [
        'type' => 'language',
    ],
];
Copied!

Introduction

The main purpose of the TCA language configuration is to simplify the TCA language configuration. It therefore supersedes the special=languages option of TCA columns with type=select.

Formerly foreign_table relations to the table sys_language had also been used. This became deprecated with the introduction of site configurations with TYPO3 v9.

This field type decouples the actually available site languages from the sys_language table.

This TCA type automatically displays all available languages for the current context (the corresponding site configuration) and also automatically adds the special -1 language (meaning all languages) for all record types, except pages.

In records on root level (pid=0) or on a page, outside of a site context, all languages from all site configurations are displayed in the new field.

Examples

Simple language field

EXT:myExtension/Configuration/Overrides/someTable.php
<?php

$GLOBALS['TCA'][$someTable]['columns'][$someLanguageField] = [
    'label' => 'Some language field',
    'config' => [
        'type' => 'language',
    ],
];
Copied!

Language field properties

Since the TCA type language is mostly based on the type=select internally, most of the associated TCA and TSconfig options can still be applied. This includes for example the selectIcons field wizard, as well as the keepItems and removeItems page TSconfig options.

Migration

An automatic TCA migration is performed on the fly, migrating all occurrences to the new TCA type and adding a deprecation message to the deprecation log where code adaption has to take place. Occurrences are all columns, defined as $TCA['ctrl']['languageField'], as well as all columns, using the special=languages option in combination with type=select.

// Before

'config' => [
    'type' => 'select',
    'renderType' => 'selectSingle',
    'foreign_table' => 'sys_language',
    'items' => [
        ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1],
        ['LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0]
    ],
    'default' => 0
]

// After

'config' => [
    'type' => 'language'
]
Copied!
// Before

'config' => [
    'type' => 'select',
    'renderType' => 'selectSingle',
    'special' => 'languages',
    'items' => [
        [
            'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages',
            -1,
            'flags-multiple'
        ],
    ],
    'default' => 0,
]

// After

'config' => [
    'type' => 'language'
]
Copied!

History

A new TCA field type called language was added to TYPO3 Core with v11.2. Its main purpose is to simplify the TCA language configuration. It therefore supersedes the special=languages option of TCA columns with type=select as well as the now mis-use of the foreign_table option, being set to sys_language.

Since the introduction of site configurations and the corresponding site languages back in v9, the sys_language table was not longer the only source of truth regarding available languages. Actually, the languages, available for a record, are defined by the associated site configuration.

The language field type therefore allows to finally decouple the actually available site languages from the sys_language table. This effectively reduces quite an amount of code and complexity, since no relations have to be fetched and processed anymore. This also makes the sys_refindex table a bit smaller, since no entries have to be added for this relation anymore. To clean up your exisiting reference index, you might use the CLI command bin/typo3 referenceindex:update.

Another pain point was the special -1 language which always had to be added to each TCA configuration manually. Thus, a lot of different implementations of this special case could be found in one and the same TYPO3 installation.

The new TCA type now automatically displays all available languages for the current context (the corresponding site configuration) and also automatically adds the special -1 language for all record types, except pages.

The none field

There are three columns config types that do similar things but still have subtle differences between them. These are the none type, the passthrough type and the user type.

Characteristics of none:

  • The DataHandler discards values send for type none and never persists or updates them in the database.
  • Type none is the only type that does not necessarily need a database field.
  • Type none fields does have a default renderType in FormEngine that displays the value as readonly if a database field exists and the value can be formatted.
  • If no database field exists for none fields, an empty readonly input field is rendered by default.
  • Type none fields are designed to be not rendered at other places in the backend, for instance they can not be selected to be displayed in the list module "single table view" if everything has been configured correctly.

The none field can be useful, if:

  • A "virtual" field that has no database representation is needed. A simple example could be a rendered map that receives values from latitude and longitude fields but that needs to database representation itself.
  • A third party feeds the database field with a value and the value should be formatted and displayed in FormEngine. However, a input type with readOnly=true is usually better suited to do that.

Since the formatting part of none fields can be done with input type as well, most useful usage of type none fields is a "virtual" field that is combined with a custom renderType by an extension. The TYPO3 core makes little or no use of none fields itself.

Example: Simple none field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'none_1' => [
            'label' => 'none_1',
            'description' => 'default',
            'config' => [
                'type' => 'none',
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type none

Name Type Scope
string (keyword) + array Display
integer Display

fieldInformation

fieldInformation

For details see fieldInformation.

format

format
Type
string (keyword) + array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The value of a none-type fields is normally displayed as is. It is however possible to format it using this property. The following keywords are available, some having sub-properties. Sub-properties are called with the format. keyword (note the trailing dot), which in itself is an array.

date

Formats the value of the field as a date. The default formatting uses PHP's date() function and d-m-Y as a format.

Possible options are:

strftime
(boolean) If true, strftime() is used instead date() for formatting.
option
(string) Format string (i.e. Y-m-d or %x, etc.).
appendAge
(boolean) If true, the age of the value is appended is appended to the formatted output.
datetime
Formats the values using PHP's date() function and H:i d-m-Y as a format.
time
Formats the values using PHP's date() function and H:i as a format.
timesec
Formats the values using PHP's date() function and H:i:s as a format.
year
Formats the values using PHP's date() function and Y as a format.
int

Formats the values as an integer using PHP's sprintf() in various bases. The default base is decimal (dec). The base is defined as an option:

base
(string) Defines the base of the value. Possible bases are "dec", "hex", "HEX", "oct" and "bin".
float

Formats the values as an real number using PHP's sprintf() and the %f marker. The number of decimals is an option:

precision
(integer) Defines the number of decimals to use (maximum is 10, default is 2).
number

Formats the values as a number using PHP's sprintf(). The format to use is an option:

option
(string) A format definition according to PHP's sprintf() function (see the reference).
md5
Returns the md5 hash of the values.
filesize

Formats the values as file size using \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(). One option exists:

appendByteSize
(boolean) If true, the original value is appended to the formatted string (between brackets).
user

Calls a user-defined function to format the values. The only option is the reference to the function:

userFunc
(string) Reference to the user-defined function. The function receives the field configuration and the field's value as parameters.

Examples .. code-block:: php

'aField' => [
'config' => [
'type' => 'none', 'format' => 'date' 'format.' => [ 'strftime' => TRUE, 'option' => '%x' ],

],

],

'aField' => [
  'config' => [
     'type' => 'none',
     'format' => 'float'
     'format.' => [
        'precision' => 8
     ],
  ],
],
Copied!
'aField' => [
  'config' => [
    'type' => 'none',
    'format' => 'user',
    'format.' => [
        'userFunc' => 'Evoweb\Example\Utility\MyCustomValue->getErrorMssg',
    ],
  ],
],
Copied!

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Value for the width of the <input> field. To set the input field to the full width of the form area, use the value 50. Default is 30.

Migration

Rename the option cols to size.

  'columns' => [
      'aColumn' => [
          'config' => [
              'type' => 'none',
-             'cols' => 20,
+             'size' => 20,
          ],
      ],
  ],
Copied!

Number

New in version 13.0

The TCA type number should be used to input values representing numbers.

The according database field is generated automatically.

Properties of the TCA column type number

Name Type Scope
boolean Proc.
boolean Display
string Display / Proc.
array
array
array
string (keyword) Display
string (keywords) Display
boolean Proc
array Proc.
boolean Display
boolean Display / Proc.
integer Display
array Display
array Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$numberField = [
    'config' => [
        'type' => 'number',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

autocomplete

autocomplete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
false

Controls the autocomplete attribute of a given number field. If set to true, adds attribute autocomplete="on" to the number input field allowing browser auto filling the field:

<?php

$temporaryColumns['numberField'] = [
    'label' => 'Integer field with autocomplete',
    'config' => [
        'type' => 'number',
        'size' => 20,
        'nullable' => true,
        'autocomplete' => true,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no number gets selected.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

format

format
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Keywords: integer, decimal

The format property defines, which type of number should be handled. The integer format is a simple number, whereas the decimal format is a float value with two decimal places.

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The if database field is created automatically, it allow the NULL value.

Example: A nullable number field
EXT:some_extension/Configuration/TCA/tx_sometable.php
<?php

$temporaryColumns['numberField'] = [
    'label' => 'Integer field with autocomplete',
    'config' => [
        'type' => 'number',
        'size' => 20,
        'nullable' => true,
        'autocomplete' => true,
    ],
];
Copied!

range

range
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

An array which defines an integer range within which the value must be. Keys:

lower
Defines the lower integer value.
upper
Defines the upper integer value.

It is allowed to specify only one of both of them.

Example: Limit an integer to be within the range 10 to 1000
'aField' => [
    'label' => 'aLabel',
    'config' => [
        'type' => 'number',
        'range' => [
            'lower' => 10,
            'upper' => 1000
        ],
    ],
],
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the number field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

slider

slider
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Render a value slider next to the field.

It is advised to also define a range property, otherwise the slider will go from 0 to 10000. Note the range can be negative if needed. Available keys:

step (integer / float)
Set the step size the slider will use. For floating point values this can itself be a floating point value.
width (integer, pixels)
Define the width of the slider.
Example: Integer slider between 0 and 100
<?php

$temporaryColumns['numberField'] = [
    'label' => 'Percent (0-100)',
    'config' => [
        'type' => 'number',
        'range' => [
            'lower' => 0,
            'upper' => 100,
        ],
        'slider' => [
            'step' => 1,
        ],
    ],
];
Copied!
Example: Integer slider between 0 and 10 000
<?php

$temporaryColumns['numberField'] = [
    'label' => 'A number between 0 and 10 000',
    'config' => [
        'type' => 'number',
        'slider' => [
            'step' => 1,
        ],
    ],
];
Copied!
Example: Decimal slider between 0 and 1
<?php

$temporaryColumns['numberField'] = [
    'label' => 'Number field with decimal slider',
    'config' => [
        'type' => 'number',
        'format' => 'decimal',
        'range' => [
            'lower' => 0,
            'upper' => 1,
        ],
        'slider' => [
            'step' => 0.1,
        ],
    ],
];
Copied!

valuePicker

valuePicker
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Renders a select box with static values next to the input field. When a value is selected in the box, the value is transferred to the field. Keys:

mode (keyword)
blank (or not set)
The selected value substitutes the value in the input field
append
The selected value is appended to an existing value of the input field
prepend
The selected value is prepended to an existing value of the input field
items (array)
An array with selectable items. Each item is an array with the first value being the label in the select drop-down (LLL reference possible) the second being the value transferred to the input field.
Example: Number field with value picker
<?php

$temporaryColumns['numberField'] = [
    'label' => 'Number field',
    'config' => [
        'type' => 'number',
        'mode' => '',
        'valuePicker' => [
            'items' => [
                ['One', '1'],
                ['Two', '2'],
            ],
        ],
    ],
];
Copied!

Pass through / virtual field

Table of contents:

Introduction

There are three columns config types that do similar things but still have subtle differences between them. These are the none type, the passthrough type and the user type.

Characteristics of passthrough:

  • A value sent to the DataHandler is kept as is and put into the database field. However, the default TYPO3 backend forms never send data for a passthrough field.
  • Unlike the field type none, the field type passthrough must have a database field.
  • The TYPO3 backend forms do not render anything for passthrough fields by default. But they can be combined with a custom renderType to display something. A field of type user is better suited for such use cases, though.
  • Values of passthrough fields are usually not rendered at other places in the backend.
  • Field updates by the DataHandler get logged and the history/undo function will work with such values.

The passthrough field can be useful, if:

  • A field needs no rendering, but some data handling using hooks of the DataHandler.
  • The passthrough type is used by TYPO3 core to handle meta data on records rows that are not shown as fields if editing records and only have data logic attached to it. An example is the l10n_diffsource field whose data is rendered differently in FormEngine at other places if editing a record but still updated and handled by the DataHandler.

Typical usages of the field type passthrough is a field that only needs data evaluation on the DataHandler side, but no rendering definition. The DataHandler does not evaluate the value in any way by default.

Since there is no rendering mode for this field type it is specifically fitted for direct API usage with the DataHandler.

Examples

This field is found in a number of tables, for instance the "pages" table. It is used by the system extension "impexp" to store some information.

'tx_impexp_origuid' => [
    'config' => [
        'type' => 'passthrough'
    ],
],
Copied!

Properties

Password

New in version 13.0

The TCA type password should be used for input values that represent passwords.

The according database field is generated automatically.

Example: A basic password field:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_1' => [
            'label' => 'password_1',
            'description' => 'type=password',
            'config' => [
                'type' => 'password',
            ],
        ],
    ],
]
Copied!

Example: A password field with password generator

A password generator using special chars.

A password generator using special chars.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_6' => [
            'label' => 'password_6',
            'description' => 'type=password fieldControl=passwordGenerator - all character sets',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random password',
                            'passwordRules' => [
                                'specialCharacters' => true,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

For more options on generating passwords see Property passwordGenerator and Password generator examples.

Properties of the TCA column type password

Name Type Scope
boolean Proc.
boolean Display
string Display / Proc.
array
array
array
boolean Proc.
string (keywords) Display
boolean Proc
boolean Display
string Display, Proc.
string, hexadecimal password representation Display
boolean Display
boolean Display / Proc.
integer Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$passwordField = [
    'config' => [
        'type' => 'password',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

autocomplete

autocomplete
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
false

By default, the autocomplete=new-password attribute will be added to the resulting input field. If autocomplete=true is configured in TCA, a autocomplete=current-password attribute will be added to the element.

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'size' => 20,
            'autocomplete' => true,
        ],
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no password gets selected.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

hashed

hashed
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Default
true

If hashed is set to false, if the field value will be saved as plaintext to the database.

Example: The password will be saved as plain text:
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_2' => [
            'label' => 'password_2',
            'description' => 'type=password hashed=false',
            'config' => [
                'type' => 'password',
                'hashed' => false,
            ],
        ],
    ],
]
Copied!

mode

mode
Type
string (keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The database field must allow the NULL value.

Example: A nullable password field
<?php

$passwordField = [
    'config' => [
        'title' => 'A nullable field',
        'config' => [
            'type' => 'password',
            'nullable' => true,
        ],
    ],
];
Copied!

passwordGenerator

passwordGenerator
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']
Scope
Display

The control renders a button next to the password field allowing the user to generate a random password based on defined rules.

Using the control adds the generated password to the corresponding field. The password is visible to the backend user only once and stored encrypted in the database. Integrators are also able to define whether the user is allowed to edit the generated password before saving.

A basic password generator

A basic password generator

The same field as above after saving - the password is not displayed anymore

The same field as above after saving - the password is not displayed anymore

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

$GLOBALS['TCA']['tx_myextension_table']['columns']['password_field'] = [
    'label' => 'Password',
    'config' => [
        'type' => 'password',
        'fieldControl' => [
            'passwordGenerator' => [
                'renderType' => 'passwordGenerator',
            ],
        ],
    ],
];
Copied!

passwordPolicy

passwordPolicy
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordPolicy']
Scope
Display, Proc.

This option assigns a password policy to fields of the type password. For configured fields, the password policy validator will be used in DataHandler to ensure, that the new password complies with the configured password policy.

Password policy requirements are shown below the password field, when the focus is changed to the password field.

See also: Examples for using different password policies in TCA.

placeholder

placeholder
Type
string, hexadecimal password representation
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a hexadecimal password representation.

<?php

$temporaryColumns['aColorField'] = [
    'title' => 'My color field',
    'config' => [
        'type' => 'color',
        'placeholder' => '#FF8700',
        'mode' => 'useOrOverridePlaceholder',
    ],
];
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the password field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

Examples for using different password policies in TCA

Use the default policy

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => 'default',
        ],
    ],
];
Copied!

Use the globally defined policy for frontend

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => $GLOBALS['TYPO3_CONF_VARS']['FE']['passwordPolicy'] ?? '',
        ],
    ],
];
Copied!

Use the globally defined policy for backend

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => $GLOBALS['TYPO3_CONF_VARS']['BE']['passwordPolicy'] ?? '',
        ],
    ],
];
Copied!

Password generator examples

Include special characters

Example: qe8)i2W1it-msR8

A password generator using special chars.

A password generator using special chars.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_6' => [
            'label' => 'password_6',
            'description' => 'type=password fieldControl=passwordGenerator - all character sets',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random password',
                            'passwordRules' => [
                                'specialCharacters' => true,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Only digits, length 8 (minimum length)

Example: 28233371

A generated 8 digit number

A generated 8 digit number

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_7' => [
            'label' => 'password_7',
            'description' => 'type=password fieldControl=passwordGenerator length=8 - only digits',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random number',
                            'passwordRules' => [
                                'length' => 8,
                                'lowerCaseCharacters' => false,
                                'upperCaseCharacters' => false,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Hexadecimal random bytes, length 30

Example: 0d95c0936c54b97bf908a3c963b508.

A generated 30 characters long random hex string

A generated 30 characters long random hex string

The following example will generate a 30 characters long random hex string, which could be used for secret tokens or similar:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_4' => [
            'label' => 'password_4',
            'description' => 'type=password fieldControl=passwordGenerator random=hex',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random hex string',
                            'passwordRules' => [
                                'length' => 30,
                                'random' => 'hex',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Base64 random bytes, readonly

Example: zrt8sJd6GiqUI_EFgjPiedOj--D0NbTVOJz

A password generator using base64 random bytes, readonly

A password generator using base64 random bytes, readonly.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_5' => [
            'label' => 'password_5',
            'description' => 'type=password fieldControl=passwordGenerator random=base64 allowEdit=false',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random base64 string',
                            'allowEdit' => false,
                            'passwordRules' => [
                                'length' => 35,
                                'random' => 'base64',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties

Field control options

title

title

title
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['title']
Type
String / localized string
Default
"LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.generatePassword"

Define a title for the control button.

allowEdit

allowEdit

allowEdit
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['allowEdit']
Type
boolean
Default
true

If set to false, the user cannot edit the generated password.

Password rules

Define rules for the password.

passwordRules.length

passwordRules.length

passwordRules.length
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['length']
Type
int
Default
16
Minimum
8

Defines the amount of characters for the generated password.

passwordRules.random

passwordRules.random

passwordRules.random
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['random']
Type
String
Values
"hex", "base64"

Defines the encoding of random bytes. Overrules character definitions.

"hex"
Generates a random password in hexadecimal format. Example: d0f4030d568ab483b8442735e9e3a7.
"base64"
Generates a random password in base64 format. Example: dtbpykd4vf1hda_Ag9kG983y-_N2zyLZzof.

passwordRules.digitCharacters

passwordRules.digitCharacters

passwordRules.digitCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['digitCharacters']
Type
boolean
Default
true

If set to false, the generated password contains no digit.

passwordRules.lowerCaseCharacters

passwordRules.lowerCaseCharacters

passwordRules.lowerCaseCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['lowerCaseCharacters']
Type
boolean
Default
true

If set to false, the generated password contains no lower case characters.

passwordRules.upperCaseCharacters

passwordRules.upperCaseCharacters

passwordRules.upperCaseCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['upperCaseCharacters']
Type
boolean
Default
true

If set to false, the generated password contains no upper case characters.

passwordRules.specialCharacters

passwordRules.specialCharacters

passwordRules.specialCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['specialCharacters']
Type
boolean
Default
false

If set to true, the generated password also contains special characters (!"#$%&\'()*+,-./:;<=>?@[\]^_{|} `).

Radio buttons

New in version 13.0

This type creates a set of radio buttons. The value is typically stored as integer value, each radio item has one assigned number, but it can be a string, too.

The according database field is generated automatically.

Example: Set of radio buttons field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'radio_1' => [
            'label' => 'radio_1',
            'description' => 'radio_1 three options, one without label',
            'config' => [
                'type' => 'radio',
                'items' => [
                    [
                        'label' => 'foo',
                        'value' => 1,
                    ],
                    [
                        'label' => '',
                        'value' => 2,
                    ],
                    [
                        'label' => 'foobar',
                        'value' => 3,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type radio

Name Type Scope
boolean Proc.
string Display / Proc.
array
array
array Display / Proc.
string (class->method reference) Display / Proc.
boolean Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$radioField = [
    'config' => [
        'type' => 'radio',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no radio gets selected.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

items

items
Type
array
Required

true

Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

An array of values which can be selected.

Each entry is in itself an associative array.

label (string or LLL reference)
The displayed title.
value (integer or string)
The value stored in the database.

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Example
Example: Checkboxes with itemsProcFunc

PHP method which is called to fill or manipulate the items array. It is recommended to use the actual FQCN with class and then concatenate the method:

\VENDOR\Extension\UserFunction\FormEngine\YourClass::class . '->yourMethod'

This becomes handy when using an IDE and doing operations like renaming classes.

The provided method will have an array of parameters passed to it. The items array is passed by reference in the key items. By modifying the array of items, you alter the list of items. A method may throw an exception which will be displayed as a proper error message to the user.

Passed parameters
  • items (passed by reference)
  • config (TCA config of the field)
  • TSconfig (The matching itemsProcFunc TSconfig)
  • table (current table)
  • row (current database record)
  • field (current field name)
  • effectivePid (correct page ID)
  • site (current site)

The following parameter only exists if the field has a flex parent.

  • flexParentDatabaseRow

The following parameters are filled if the current record has an inline parent:

  • inlineParentUid
  • inlineParentTableName
  • inlineParentFieldName
  • inlineParentConfig
  • inlineTopMostParentUid
  • inlineTopMostParentTableName
  • inlineTopMostParentFieldName

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

Select fields

New in version 13.0

When using the select type, TYPO3 takes care of generating the according database field. A developer does not need to define this field in an extension's ext_tables.sql file. The field length can be adjusted with the option .

The according database field for all render types of select boxes fields are generated automatically.

Introduction

Selector boxes are very common elements in forms. By the "select" type you can create selector boxes. In the most simple form this is a list of values among which you can choose only one.

There are various shapes of the select type, the images below give an overview. The basic idea is that all possible child elements are always listed. This is in contrast to the group type which lists only selected elements and helps with selecting others via element browser and other tools.

The select type is pretty powerful, there are a lot of options to steer both rendering and database handling.

Select TCA type is used to model a static selection of items or a n:1 database relation or a n:m database relation. For database relations the foreign_table TCA option is required.

In case of static items the values of the selected items are stored as CSV content.

In case of n:1 (e.g. Organization has one Administrator) the uid of Administrator is stored in the select column of the Organization.

In case of the n:m (e.g. Organization has multiple categories) the uid of the selected categories are stored either in CSV style inside the select column of the organization or as records in an MM-table, if specified in TCA.

The chosen renderType influences the behaviour of the element and how it will be displayed.

The following renderTypes are available:

  • selectSingle: Select one element from a list of elements
  • selectSingleBox: Select one or more elements from a list of elements
  • selectCheckBox: One or more checkboxes are displayed instead of a select list.
  • selectMultipleSideBySide: Two select fields, items can be selected from the right field, selected items are displayed in the left select.
  • selectTree: A tree for selecting hierarchical data items.

selectSingle

Single select fields display a select field from which only one value can be chosen.

The according database field is generated automatically.

The renderType selectSingle creates a drop-down box with items to select a single value. Only if size is set to a value greater than one, a box is rendered containing all selectable elements from which one can be chosen.

Examples for select fields with renderType selectSingle

Simple select drop down with static and database values

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

Select foreign rows with icons

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Select a single value from a list of elements

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_10' => [
            'label' => 'select_single_10 size=6, three options',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'a divider',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                ],
                'size' => 6,
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type select with renderType selectSingle

Name Type Scope
boolean Proc.
string (keyword) Display / Proc.
integer Display
boolean Proc.
integer Proc.
string Display / Proc.
boolean Display
array
array
array
array fieldWizard
string Display / Proc.
integer Display / Proc.
string Display / Proc.
string (table name) Proc. / Display
string (column name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
array Display / Proc.
string (class->method reference) Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
boolean Display / Proc.
boolean Display
integer Display
array Display

allowNonIdValues

allowNonIdValues
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
RenderType
all

Only useful if foreign_table is enabled.

If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list.

authMode

authMode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Authorization mode for the selector box. The only possible option is:

explicitAllow
All static values from the "items" array of the selector box will be added to a matrix in the backend user configuration where a value must be explicitly selected if a user (other than admin) is allowed to use it!)

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$inlineField = [
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbFieldLength

dbFieldLength
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
255
Scope
Proc.

New in version 13.0

The TCA config option dbFieldLength contains an integer value that is applied to varchar fields (not text) and defines the length of the database field. It will not be respected for fields that resolve to an integer type. Developers who wish to optimize field length can use dbFieldLength for type=select fields to increase or decrease the default length.

Example: Increase the dbFieldLength for a select field
Excerpt from EXT:my_extension/Configuration/TCA/myextension_domain_model_mytable.php
<?php

$selectField = [
    'label' => 'My field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
            ['label' => '', 'value' => ''],
            ['label' => 'Some label', 'value' => 'some'],
            ['label' => 'Another label', 'value' => 'another'],
        ],
        'default' => '',
        'dbFieldLength' => 10,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, the first element in the items array is selected.

disableNoMatchingValueElement

disableNoMatchingValueElement
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

If set, then no element is inserted if the current value does not match any of the existing elements. A corresponding options is also found in Page TSconfig.

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

selectIcons

selectIcons
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['selectIcons']
Scope
fieldWizard

Render thumbnails of icons below the select drop-down. Disabled by default.

fileFolderConfig

fileFolderConfig

allowedExtensions

allowedExtensions
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['allowedExtensions']
Scope
Display / Proc.

List of file extensions to select. If blank, all files are selected. Specify list in lowercase.

This configuration can be overridden by Page TSconfig.

depth

depth
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['depth']
Scope
Display / Proc.
RenderType
all

Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. Only useful in combination with property folder.

This configuration can be overridden by Page TSconfig.

folder

folder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['folder']
Scope
Display / Proc.

Specifying a folder from where files are added to the item array.

Specify the folder relative to the \TYPO3\CMS\Core\Core\Environment::getPublicPath(). See getPublicPath() . Alternatively use the prefix "EXT:" to point to an extension folder.

Files from the folder are selected recursively to the level specified by depth and only files of the extensions defined by allowedExtensions are listed in the select box.

Only the file reference relative to the folder is stored.

If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array).

This configuration can be overridden by Page TSconfig.

Examples: Select SVGs recursively from a folder
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_7' => [
            'label' => 'select_single_7 fileFolder, dummy first entry, selectIcons',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => '',
                        'value' => 0,
                    ],
                ],
                'fileFolderConfig' => [
                    'folder' => 'EXT:styleguide/Resources/Public/Icons',
                    'allowedExtensions' => 'svg',
                    'depth' => 1,
                ],
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma separated list by default.

Use property MM <columns-select-single-properties-mm> to store the values in an intermediate MM table instead.

Example: Select singe field with enabled selectIcons
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: Select field with foreign table via MM table
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_15' => [
            'label' => 'select_single_15 foreign_table',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_staticdata',
                'MM' => 'tx_styleguide_elements_select_single_15_mm',
            ],
        ],
    ],
]
Copied!

foreign_table_item_group

foreign_table_item_group
Type
string (column name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

New in version 13.0

This property references a specific field in the foreign table, which holds an item group identifier.

Example: A select field with a foreign_table_item_group
<?php

$selectField = [
    'label' => 'select_field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
            [
                'label' => 'static item 1',
                'value' => 'static-1',
                'group' => 'group1',
            ],
        ],
        'itemGroups' => [
            'group1' => 'Group 1 with items',
            'group2' => 'Group 2 from foreign table',
        ],
        'foreign_table' => 'tx_myextension_foreign_table',
        'foreign_table_item_group' => 'itemgroup',
    ],
];
Copied!

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

Label prefix to the title of the records from the foreign-table.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The items from foreign_table are selected with this WHERE clause. The WHERE clause is effectively appended to the existing WHERE clause (which contains default constraints, such as NOT deleted) and must begin with AND.

Field quoting

The example below uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible. Note that ORDER BY and GROUP BY should NOT be quoted, since they always receive proper quoting automatically through the API.

Markers inside the WHERE statement

It is possible to use markers in the WHERE clause:

###REC_FIELD_[field name]###

Any field of the current record.

###THIS_UID###
Current element uid (zero if new).
###CURRENT_PID###
The current page id (pid of the record).

###SITEROOT###

###PAGE_TSCONFIG_ID###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_IDLIST###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_STR###
A value you can set from Page TSconfig dynamically.
###SITE:<KEY>.<SUBKEY>###
A value from the site configuration, for example: ###SITE:mySetting.categoryPid### or ###SITE:rootPageId###.

The markers are preprocessed so that the value of CURRENT_PID and PAGE_TSCONFIG_ID are always integers (default is zero), PAGE_TSCONFIG_IDLIST will always be a comma-separated list of integers (default is zero) and PAGE_TSCONFIG_STR will be quoted before substitution (default is blank string).

More information about markers set by Page TSconfig can be found in the TSconfig reference.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

itemGroups

itemGroups
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains an array of key-value pairs. The key contains the id of the item group, the value contains the label of the item group or its language reference.

Only groups containing items will be displayed. In the select field first all items with no group defined are listed then the item groups in the order of their definition, each group with the corresponding items.

Item groups are rendered as <optgroup>.

Item groups can also be defined for items in foreign tables.

See also Item group API methods

Example: SelectSingle field with itemGroups
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_16' => [
            'label' => 'select_single_16',
            'description' => 'itemGroups',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'item 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                        'group' => 'group3',
                    ],
                    [
                        'label' => 'item 4',
                        'value' => 3,
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
            ],
        ],
    ],
]
Copied!
Example: SelectSingle field with itemGroups, size=6
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_17' => [
            'label' => 'select_single_16',
            'description' => 'itemGroups, size=6',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'item 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                        'group' => 'group3',
                    ],
                    [
                        'label' => 'item 4',
                        'value' => 3,
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
                'size' => 6,
            ],
        ],
    ],
]
Copied!

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains the elements for the selector box unless the property foreign_table or special has been set in which case automated values are set in addition to any values listed in this array.

Changed in version 13.0

Auto-registration of New content element wizard via TCA introduced. If your extension supports both TYPO3 v12 and v13, keep the page TSconfig option newContentElement.wizardItems until dropping TYPO3 v12 support.

Items registered for the field CType of table tt_content get automatically added to the New content element wizard. Settings from the items property can be overridden via page TSconfig newContentElement.wizardItems.

See also Add content elements to the Content Element Wizard.

Each element in this array is in itself an associative array.

label (string or LLL reference)
The displayed title.
value (integer or string)

The value stored in the database.

  • The special value --div-- was used to insert a non-selectable
    value that appears as a divider label in the selector box. It is kept for backwards-compatible reasons. Use item groups for custom selects instead.
  • Values must not contain , (comma) and | (vertical bar). If you want to use authMode, you should
    also refrain from using : (colon).
icon (EXT: path or icon identifier)
Optional icon. For custom icons use a path prepended with EXT: to refer to an image file found inside an extension or use an registered icon identifier. If configured on the foreign_table, selicon-field is respected.
group (string)
The key of the item group.
description (string or array)
Fifth value is an optional description text. This is only shown when the list is shown with renderType='selectCheckBox'.
Example: Simple items definition with label and value
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_1' => [
            'label' => 'select_single_1 two items, long text description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'foo and this here is very long text that maybe does not really fit into the form in one line. Ok let us add even more text to see how this looks like if wrapped. Is this enough now? No? Then let us add some even more useless text here!',
                        'value' => 1,
                    ],
                    [
                        'label' => 'bar',
                        'value' => 'bar',
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: Items definition with label, value and icon

A more complex example could be this (includes icons):

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_4' => [
            'label' => 'select_single_4 items with icons',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 'foo1',
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 'foo2',
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: SelectSingle field with itemGroups

A select single field of size 6 with 3 item groups and one item without group.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_17' => [
            'label' => 'select_single_16',
            'description' => 'itemGroups, size=6',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'item 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                        'group' => 'group3',
                    ],
                    [
                        'label' => 'item 4',
                        'value' => 3,
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
                'size' => 6,
            ],
        ],
    ],
]
Copied!

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

PHP method which is called to fill or manipulate the items array. See itemsProcFunc about details.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

Example: Select field with foreign table via MM table
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_15' => [
            'label' => 'select_single_15 foreign_table',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_staticdata',
                'MM' => 'tx_styleguide_elements_select_single_15_mm',
            ],
        ],
    ],
]
Copied!

MM_match_fields

MM_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

In a MM bidirectional relation using match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
1

If set to 1 (default), displays a select drop-down, else a select box of given size.

sortItems

sortItems

sortItems
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

The property sortItems allows sorting of static select items by their values or labels.

Built-in orderings are to sort items by their labels or values. It is also possible to define custom sorting via PHP code.

When using grouped select fields with itemGroups, sorting happens on a per-group basis - all items within one group are sorted - as the group ordering is preserved.

Examples

Sort items by label

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_18' => [
            'label' => 'select_single_18',
            'description' => 'sortItems label asc',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Plum tree',
                        'value' => 1,
                    ],
                    [
                        'label' => 'Walnut tree',
                        'value' => 2,
                    ],
                    [
                        'label' => 'Apple tree',
                        'value' => 3,
                    ],
                    [
                        'label' => 'Cherry tree',
                        'value' => 4,
                    ],
                ],
                'sortItems' => [
                    'label' => 'asc',
                ],
                'size' => 4,
            ],
        ],
    ],
]
Copied!

Sort items by value

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_19' => [
            'label' => 'select_single_19',
            'description' => 'sortItems value desc',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Plum tree',
                        'value' => 1,
                    ],
                    [
                        'label' => 'Walnut tree',
                        'value' => 2,
                    ],
                    [
                        'label' => 'Apple tree',
                        'value' => 3,
                    ],
                    [
                        'label' => 'Cherry tree',
                        'value' => 4,
                    ],
                ],
                'sortItems' => [
                    'value' => 'desc',
                ],
                'size' => 4,
            ],
        ],
    ],
]
Copied!

Sort items by a custom method

The following custom method sorts the items by their reversed labels:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_20' => [
            'label' => 'select_single_20',
            'description' => 'sortItems custom',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Plum tree',
                        'value' => 1,
                    ],
                    [
                        'label' => 'Walnut tree',
                        'value' => 2,
                    ],
                    [
                        'label' => 'Apple tree',
                        'value' => 3,
                    ],
                    [
                        'label' => 'Cherry tree',
                        'value' => 4,
                    ],
                ],
                'sortItems' => [
                    'tx_styleguide' => 'TYPO3\\CMS\\Styleguide\\UserFunctions\\FormEngine\\SelectItemSorter->sortReverseTitles',
                ],
                'size' => 4,
            ],
        ],
    ],
]
Copied!
<?php

declare(strict_types=1);

/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

namespace TYPO3\CMS\Styleguide\UserFunctions\FormEngine;

/**
 * A user function to sort ites
 *
 * @internal
 */
final class SelectItemSorter
{
    /**
     * Sort items by their reverse titles
     *
     * @param array $items
     */
    public function sortReverseTitles(&$items): void
    {
        @usort(
            $items,
            function ($item1, $item2) {
                return strcasecmp(strrev((string)$item1[0]), strrev((string)$item2[0]));
            }
        );
    }
}
Copied!

Select multiple values (selectSingleBox)

This page describes the select type with renderType='selectSingleBox'.

The according database field is generated automatically.

Renders a select field to select multiple entries from a given list.

Example: Select multiple values from a box

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_singlebox_1' => [
            'label' => 'select_singlebox_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingleBox',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'divider',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type select with renderType selectSingleBox

Name Type Scope
boolean Proc.
string (keyword) Display / Proc.
boolean Proc.
integer Proc.
string Display / Proc.
boolean Display
array fieldControl
array
array
array
string Display / Proc.
integer Display / Proc.
string Display / Proc.
string (table name) Proc. / Display
string (column name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
array Display / Proc.
string (class->method reference) Display / Proc.
boolean Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
boolean Display / Proc.
boolean Display
integer Display

allowNonIdValues

allowNonIdValues
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
RenderType
all

Only useful if foreign_table is enabled.

If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list.

authMode

authMode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Authorization mode for the selector box. The only possible option is:

explicitAllow
All static values from the "items" array of the selector box will be added to a matrix in the backend user configuration where a value must be explicitly selected if a user (other than admin) is allowed to use it!)
Migration: Using authMode='explicitDeny'

The "deny list" approach for single field values has been removed, the only allowed option for authMode is explicitAllow. Extensions using config value explicitDeny should be adapted to switch to explicitAllow instead. The upgrade wizard "Migrate backend groups "explicit_allowdeny" field to simplified format." that transfers existing be_groups rows to the new format, drops any DENY fields and instructs admins to not set new access rights of affected backend groups.

Migration: Using authMode='individual'

Handling of authMode being set to individual has been fully dropped. The Core provides no alternative. This has been an obscure setting ever since and there is no direct migration. Extensions that rely on this handling need to find a substitution based on Core hooks, Core events or other existing Core API functionality.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$selectField = [
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingleBox',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbFieldLength

dbFieldLength
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
255
Scope
Proc.

New in version 13.0

The TCA config option dbFieldLength contains an integer value that is applied to varchar fields (not text) and defines the length of the database field. It will not be respected for fields that resolve to an integer type. Developers who wish to optimize field length can use dbFieldLength for type=select fields to increase or decrease the default length.

Example: Increase the dbFieldLength for a select field
Excerpt from EXT:my_extension/Configuration/TCA/myextension_domain_model_mytable.php
<?php

$selectField = [
    'label' => 'My field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingleBox',
        'items' => [
            ['label' => '', 'value' => ''],
            ['label' => 'Some label', 'value' => 'some'],
            ['label' => 'Another label', 'value' => 'another'],
        ],
        'default' => '',
        'dbFieldLength' => 10,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, the first element in the items array is selected.

disableNoMatchingValueElement

disableNoMatchingValueElement
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

If set, then no element is inserted if the current value does not match any of the existing elements. A corresponding options is also found in Page TSconfig.

fieldControl

fieldControl

resetSelection

resetSelection
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']
Scope
fieldControl
Types
Description

Render a button next to the select box to reset a changed selection to the state before it was manipulated by the user.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

fileFolderConfig

fileFolderConfig

allowedExtensions

allowedExtensions
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['allowedExtensions']
Scope
Display / Proc.

List of file extensions to select. If blank, all files are selected. Specify list in lowercase.

This configuration can be overridden by Page TSconfig.

depth

depth
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['depth']
Scope
Display / Proc.
RenderType
all

Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. Only useful in combination with property folder.

This configuration can be overridden by Page TSconfig.

folder

folder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['folder']
Scope
Display / Proc.

Specifying a folder from where files are added to the item array.

Specify the folder relative to the \TYPO3\CMS\Core\Core\Environment::getPublicPath(). See getPublicPath() . Alternatively use the prefix "EXT:" to point to an extension folder.

Files from the folder are selected recursively to the level specified by depth and only files of the extensions defined by allowedExtensions are listed in the select box.

Only the file reference relative to the folder is stored.

If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array).

This configuration can be overridden by Page TSconfig.

Examples: Select SVGs recursively from a folder
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_7' => [
            'label' => 'select_single_7 fileFolder, dummy first entry, selectIcons',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => '',
                        'value' => 0,
                    ],
                ],
                'fileFolderConfig' => [
                    'folder' => 'EXT:styleguide/Resources/Public/Icons',
                    'allowedExtensions' => 'svg',
                    'depth' => 1,
                ],
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma separated list by default.

Use property MM <columns-select-singlebox-properties-mm> to store the values in an intermediate MM table instead.

Example: Select singe field with enabled selectIcons
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: Select field with foreign table via MM table
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_15' => [
            'label' => 'select_single_15 foreign_table',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_staticdata',
                'MM' => 'tx_styleguide_elements_select_single_15_mm',
            ],
        ],
    ],
]
Copied!

foreign_table_item_group

foreign_table_item_group
Type
string (column name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

New in version 13.0

This property references a specific field in the foreign table, which holds an item group identifier.

See also foreign_table_item_group.

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

Label prefix to the title of the records from the foreign-table.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The items from foreign_table are selected with this WHERE clause. The WHERE clause is effectively appended to the existing WHERE clause (which contains default constraints, such as NOT deleted) and must begin with AND.

Field quoting

The example below uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible. Note that ORDER BY and GROUP BY should NOT be quoted, since they always receive proper quoting automatically through the API.

Markers inside the WHERE statement

It is possible to use markers in the WHERE clause:

###REC_FIELD_[field name]###

Any field of the current record.

###THIS_UID###
Current element uid (zero if new).
###CURRENT_PID###
The current page id (pid of the record).

###SITEROOT###

###PAGE_TSCONFIG_ID###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_IDLIST###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_STR###
A value you can set from Page TSconfig dynamically.
###SITE:<KEY>.<SUBKEY>###
A value from the site configuration, for example: ###SITE:mySetting.categoryPid### or ###SITE:rootPageId###.

The markers are preprocessed so that the value of CURRENT_PID and PAGE_TSCONFIG_ID are always integers (default is zero), PAGE_TSCONFIG_IDLIST will always be a comma-separated list of integers (default is zero) and PAGE_TSCONFIG_STR will be quoted before substitution (default is blank string).

More information about markers set by Page TSconfig can be found in the TSconfig reference.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

itemGroups

itemGroups
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains an array of key-value pairs. The key contains the id of the item group, the value contains the label of the item group or its language reference.

Only groups containing items will be displayed. In the select field first all items with no group defined are listed then the item groups in the order of their definition, each group with the corresponding items.

Item groups are rendered as <optgroup>.

Item groups can also be defined for items in foreign tables.

See also Item group API methods

Example: SelectSingle field with itemGroups
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_16' => [
            'label' => 'select_single_16',
            'description' => 'itemGroups',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'item 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                        'group' => 'group3',
                    ],
                    [
                        'label' => 'item 4',
                        'value' => 3,
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
            ],
        ],
    ],
]
Copied!
Example: SelectSingle field with itemGroups, size=6
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_17' => [
            'label' => 'select_single_16',
            'description' => 'itemGroups, size=6',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'item 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 2',
                        'value' => 2,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'item 3',
                        'value' => 3,
                        'group' => 'group3',
                    ],
                    [
                        'label' => 'item 4',
                        'value' => 3,
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
                'size' => 6,
            ],
        ],
    ],
]
Copied!

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains the elements for the selector box unless the property foreign_table or special has been set in which case automated values are set in addition to any values listed in this array.

For examples see also property items of singleSelect.

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

PHP method which is called to fill or manipulate the items array. See itemsProcFunc about details.

localizeReferencesAtParentLocalization

localizeReferencesAtParentLocalization
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Defines whether referenced records should be localized when the current record gets localized. This only applies if references are not stored using MM tables.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_match_fields

MM_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

In a MM bidirectional relation using match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
1

Height of the box in FormEngine. This value should not be set to a number smaller than 2.

selectCheckBox

This page describes the select type with renderType='selectCheckBox'. For differences to type="check" see selectCheckBox and type check fields compared.

The according database field is generated automatically.

Example: Simple select checkbox with 3 possible values

The select checkbox stores the values as comma separated values.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_checkbox_1' => [
            'label' => 'select_checkbox_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectCheckBox',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'foo 4 (empty)',
                        'value' => '',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Example: Select checkbox with icons and groups

The select checkbox stores the values as comma separated values.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_checkbox_7' => [
            'label' => 'select_checkbox_7',
            'description' => 'itemGroups',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectCheckBox',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                        'group' => 'group1',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                    [
                        'label' => 'foo 5',
                        'value' => 1,
                        'group' => 'group3',
                    ],
                ],
                'itemGroups' => [
                    'group1' => 'Group 1 with items',
                    'group2' => 'Group 2 with no items',
                    'group3' => 'Group 3 with items',
                ],
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type select with renderType selectCheckBox

Name Type Scope
boolean Proc.
array Display
string (keyword) Display / Proc.
integer Display
boolean Proc.
integer Proc.
string Display / Proc.
boolean Display
string (list of tables) Proc.
array
array
array
array fieldWizard
string Display / Proc.
integer Display / Proc.
string Display / Proc.
string (table name) Proc. / Display
string (column name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
array Display / Proc.
string (class->method reference) Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
boolean Display / Proc.
boolean Display
integer Display

allowNonIdValues

allowNonIdValues
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
RenderType
all

Only useful if foreign_table is enabled.

If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list.

appearance

appearance

selectCheckBox

selectCheckBox
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']['selectCheckBox']
Scope
Display

Options for refining the appearance of selectCheckBox fields.

expandAll (boolean)
If set, all select groups are initially expanded.
Example: Select checkbox, all divs expanded
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_checkbox_5' => [
            'label' => 'select_checkbox_5 dividers, expandAll',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectCheckBox',
                'appearance' => [
                    'expandAll' => true,
                ],
                'items' => [
                    [
                        'label' => 'div 1',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'div 2',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                    [
                        'label' => 'foo 5',
                        'value' => 5,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

authMode

authMode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Authorization mode for the selector box. The only possible option is:

explicitAllow
All static values from the "items" array of the selector box will be added to a matrix in the backend user configuration where a value must be explicitly selected if a user (other than admin) is allowed to use it!)

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$inlineField = [
    'config' => [
        'type' => 'select',
        'renderType' => 'selectCheckBox',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbFieldLength

dbFieldLength
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
255
Scope
Proc.

New in version 13.0

The TCA config option dbFieldLength contains an integer value that is applied to varchar fields (not text) and defines the length of the database field. It will not be respected for fields that resolve to an integer type. Developers who wish to optimize field length can use dbFieldLength for type=select fields to increase or decrease the default length.

Example: Increase the dbFieldLength for a select field
Excerpt from EXT:my_extension/Configuration/TCA/myextension_domain_model_mytable.php
<?php

$selectField = [
    'label' => 'My field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectCheckBox',
        'items' => [
            ['label' => '', 'value' => ''],
            ['label' => 'Some label', 'value' => 'some'],
            ['label' => 'Another label', 'value' => 'another'],
        ],
        'default' => '',
        'dbFieldLength' => 10,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, the first element in the items array is selected.

disableNoMatchingValueElement

disableNoMatchingValueElement
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

If set, then no element is inserted if the current value does not match any of the existing elements. A corresponding options is also found in Page TSconfig.

dontRemapTablesOnCopy

dontRemapTablesOnCopy
Type
string (list of tables)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

A list of tables which should not be remapped to the new element uids if the field holds elements that are copied in the session.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

selectIcons

selectIcons
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['selectIcons']
Scope
fieldWizard

Render thumbnails of icons below the select drop-down. Disabled by default.

fileFolderConfig

fileFolderConfig

allowedExtensions

allowedExtensions
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['allowedExtensions']
Scope
Display / Proc.

List of file extensions to select. If blank, all files are selected. Specify list in lowercase.

This configuration can be overridden by Page TSconfig.

depth

depth
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['depth']
Scope
Display / Proc.
RenderType
all

Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. Only useful in combination with property folder.

This configuration can be overridden by Page TSconfig.

folder

folder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['folder']
Scope
Display / Proc.

Specifying a folder from where files are added to the item array.

Specify the folder relative to the \TYPO3\CMS\Core\Core\Environment::getPublicPath(). See getPublicPath() . Alternatively use the prefix "EXT:" to point to an extension folder.

Files from the folder are selected recursively to the level specified by depth and only files of the extensions defined by allowedExtensions are listed in the select box.

Only the file reference relative to the folder is stored.

If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array).

This configuration can be overridden by Page TSconfig.

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma separated list by default.

Use property MM <columns-select-checkbox-properties-mm> to store the values in an intermediate MM table instead.

foreign_table_item_group

foreign_table_item_group
Type
string (column name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

New in version 13.0

This property references a specific field in the foreign table, which holds an item group identifier.

See also foreign_table_item_group.

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

Label prefix to the title of the records from the foreign-table.

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The items from foreign_table are selected with this WHERE clause. The WHERE clause is effectively appended to the existing WHERE clause (which contains default constraints, such as NOT deleted) and must begin with AND.

Field quoting

The example below uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible. Note that ORDER BY and GROUP BY should NOT be quoted, since they always receive proper quoting automatically through the API.

Markers inside the WHERE statement

It is possible to use markers in the WHERE clause:

###REC_FIELD_[field name]###

Any field of the current record.

###THIS_UID###
Current element uid (zero if new).
###CURRENT_PID###
The current page id (pid of the record).

###SITEROOT###

###PAGE_TSCONFIG_ID###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_IDLIST###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_STR###
A value you can set from Page TSconfig dynamically.
###SITE:<KEY>.<SUBKEY>###
A value from the site configuration, for example: ###SITE:mySetting.categoryPid### or ###SITE:rootPageId###.

The markers are preprocessed so that the value of CURRENT_PID and PAGE_TSCONFIG_ID are always integers (default is zero), PAGE_TSCONFIG_IDLIST will always be a comma-separated list of integers (default is zero) and PAGE_TSCONFIG_STR will be quoted before substitution (default is blank string).

More information about markers set by Page TSconfig can be found in the TSconfig reference.

itemGroups

itemGroups
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains an array of key-value pairs. The key contains the id of the item group, the value contains the label of the item group or its language reference.

Only groups containing items will be displayed. In the select field first all items with no group defined are listed then the item groups in the order of their definition, each group with the corresponding items.

Item groups are rendered as <optgroup>.

Item groups can also be defined for items in foreign tables.

See also Item group API methods

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains the elements for the selector box unless the property foreign_table or special has been set in which case automated values are set in addition to any values listed in this array.

Changed in version 13.0

Auto-registration of New content element wizard via TCA introduced. If your extension supports both TYPO3 v12 and v13, keep the page TSconfig option newContentElement.wizardItems until dropping TYPO3 v12 support.

Items registered for the field CType of table tt_content get automatically added to the New content element wizard. Settings from the items property can be overridden via page TSconfig newContentElement.wizardItems.

See also Add content elements to the Content Element Wizard.

Each element in this array is in itself an associative array.

label (string or LLL reference)
The displayed title.
value (integer or string)

The value stored in the database.

  • The special value --div-- was used to insert a non-selectable
    value that appears as a divider label in the selector box. It is kept for backwards-compatible reasons. Use item groups for custom selects instead.
  • Values must not contain , (comma) and | (vertical bar). If you want to use authMode, you should
    also refrain from using : (colon).
icon (EXT: path or icon identifier)
Optional icon. For custom icons use a path prepended with EXT: to refer to an image file found inside an extension or use an registered icon identifier. If configured on the foreign_table, selicon-field is respected.
group (string)
The key of the item group.
description (string or array)
Fifth value is an optional description text.
Select checkbox field with icons and descriptions
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_checkbox_3' => [
            'label' => 'select_checkbox_3 icons, description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectCheckBox',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                        'description' => [
                            'title' => 'optional title',
                            'description' => 'optional description',
                        ],
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                        'description' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:translatedHelpTextForSelectCheckBox3',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

PHP method which is called to fill or manipulate the items array. See itemsProcFunc about details.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_match_fields

MM_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

In a MM bidirectional relation using match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Size of the input field.

selectCheckBox and type check fields compared

There is a subtle difference between select fields with the render type selectCheckBox and fields of the type check:

Select values from a checkbox list

The select checkbox stores the values as comma separated values.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_checkbox_3' => [
            'label' => 'select_checkbox_3 icons, description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectCheckBox',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                        'description' => [
                            'title' => 'optional title',
                            'description' => 'optional description',
                        ],
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                        'description' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:translatedHelpTextForSelectCheckBox3',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                        'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

The field in the database is of type text or varchar.

Select values from a checkbox list

On the contrary the type check saves multiple values as bits. Therefore if the first value is chosen it stores 1, if only the second is chosen it stores 2 and if both are chosen 3.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_3' => [
            'label' => 'checkbox_3',
            'description' => 'three checkboxes, two with labels, one without',
            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => 'foo',
                    ],
                    [
                        'label' => '',
                    ],
                    [
                        'label' => 'foobar',
                        'iconIdentifierChecked' => 'content-beside-text-img-below-center',
                        'iconIdentifierUnchecked' => 'content-beside-text-img-below-center',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

The field in the database is of type int.

selectMultipleSideBySide

This page describes the select type with 'renderType' => 'selectMultipleSideBySide'.

The according database field is generated automatically.

It displays two select fields. The items can be selected from the right field. All selected items are displayed in the left field.

Example: Basic side-by-side select field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_1' => [
            'label' => 'select_multiplesidebyside_1 autoSizeMax=10, size=3 description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'a divider',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                    [
                        'label' => 'foo 5',
                        'value' => 5,
                    ],
                    [
                        'label' => 'foo 6',
                        'value' => 6,
                    ],
                ],
                'size' => 3,
                'autoSizeMax' => 10,
                'multiple' => true,
            ],
        ],
    ],
]
Copied!

For more examples see also Advanced examples for multiple side-by-side select boxes.

Properties of the TCA column type select with renderType selectMultipleSideBySide

Name Type Scope
boolean Proc.
string (keyword) Display / Proc.
integer Display
boolean Proc.
integer Proc.
string Display / Proc.
boolean Display
string (list of) Display / Proc.
array
array
array
array fieldWizard
string Display / Proc.
integer Display / Proc.
string Display / Proc.
string (table name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
string (class->method reference) Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
array Display
boolean Display / Proc.
boolean Display
integer Display

allowNonIdValues

allowNonIdValues
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
RenderType
all

Only useful if foreign_table is enabled.

If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list.

authMode

authMode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Authorization mode for the selector box. The only possible option is:

explicitAllow
All static values from the "items" array of the selector box will be added to a matrix in the backend user configuration where a value must be explicitly selected if a user (other than admin) is allowed to use it!)

autoSizeMax

autoSizeMax
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The maximum size (height) of the select field.

The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of autoSizeMax.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$selectField = [
    'config' => [
        'type' => 'select',
        'renderType' => 'selectMultipleSideBySide',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbFieldLength

dbFieldLength
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
255
Scope
Proc.

New in version 13.0

The TCA config option dbFieldLength contains an integer value that is applied to varchar fields (not text) and defines the length of the database field. It will not be respected for fields that resolve to an integer type. Developers who wish to optimize field length can use dbFieldLength for type=select fields to increase or decrease the default length.

Example: Increase the dbFieldLength for a select field
Excerpt from EXT:my_extension/Configuration/TCA/myextension_domain_model_mytable.php
<?php

$selectField = [
    'label' => 'My field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectMultipleSideBySide',
        'items' => [
            ['label' => '', 'value' => ''],
            ['label' => 'Some label', 'value' => 'some'],
            ['label' => 'Another label', 'value' => 'another'],
        ],
        'default' => '',
        'dbFieldLength' => 10,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, the first element in the items array is selected.

disableNoMatchingValueElement

disableNoMatchingValueElement
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

If set, then no element is inserted if the current value does not match any of the existing elements. A corresponding options is also found in Page TSconfig.

exclusiveKeys

exclusiveKeys
Type
string (list of)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

List of keys that exclude any other keys in a select box where multiple items could be selected.

fieldControl

fieldControl

addRecord

addRecord
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']
Scope
fieldControl
Types
group

Control button to directly add a related record. Leaves the current view and opens a new form to add a new record. On 'Save and close', the record is directly selected.

disabled

disabled
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']
Scope
fieldControl -> addRecord
Default
true

Disables the field control. Needs to be set to false to enable the Create new button

options

options
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']

pid

pid
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']['pid']
Scope
fieldControl -> addRecord
Values
marker or an integer
Default
###CURRENT_PID###

pid of the new record. Can be an hard pid setting, or one of these markers, see select foreign_table_where.

Falls back to "current pid" if not set, forces pid=0 if records of this table are only allowed on root level.

  • ###CURRENT_PID###
  • ###THIS_UID###
  • ###SITEROOT###

title

title
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']['title']
Values
string or LLL reference
Default
LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.createNew

Allows to set a different 'title' attribute to the popup icon.

setValue

setValue
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['addRecord']['options']['setValue']
Values
string
Default
append

Can be one of 'set', 'prepend' or 'append'. With 'set' the given selection is substituted with the new record, 'prepend' adds the new record on top of the list, 'append' adds it at the bottom.

Example: Multiple sidebyside select field with "Add record" enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_1' => [
            'label' => 'select_multiplesidebyside_1 autoSizeMax=10, size=3 description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'a divider',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'foo 4',
                        'value' => 4,
                    ],
                    [
                        'label' => 'foo 5',
                        'value' => 5,
                    ],
                    [
                        'label' => 'foo 6',
                        'value' => 6,
                    ],
                ],
                'size' => 3,
                'autoSizeMax' => 10,
                'multiple' => true,
            ],
        ],
    ],
]
Copied!
Example: Select field with options

The field controls are also used in the core. The following example is from the table be_groups:

EXT:core/Configuration/TCA/be_groups.php
[
    'columns' => [
        'file_mountpoints' => [
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'sys_filemounts',
                'foreign_table_where' => ' AND {#sys_filemounts}.{#pid}=0',
                'size' => 3,
                'autoSizeMax' => 10,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_edit_title',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_add_title',
                            'setValue' => 'prepend',
                        ],
                    ],
                    'listModule' => [
                        'disabled' => false,
                        'options' => [
                            'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:file_mountpoints_list_title',
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

editPopup

editPopup
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']
Scope
fieldControl

The edit popup field control shows a pencil icon to edit an element directly in a popup window.

When a record is selected and the edit button is clicked, that record opens in a new window for modification.

disabled

disabled
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']
Scope
fieldControl -> editPopup
Default
true

Disables the field control. Needs to be set to false to enable the Create new button

options

options
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']['options']

title

title
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']['options']['title']
Values
string or LLL reference
Default
LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit

Allows to set a different 'title' attribute to the popup icon.

windowOpenParameters

windowOpenParameters
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['editPopup']['options']['windowOpenParameters']
Values
string or LLL reference
Default
height=800,width=600,status=0,menubar=0,scrollbars=1

Allows to set a different size of the popup, defaults

Example: Multiple side-by-side select with edit popup
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_6' => [
            'label' => 'select_multiplesidebyside_6 fieldControl',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'size' => 5,
                'autoSizeMax' => 20,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

resetSelection

resetSelection
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['resetSelection']
Scope
fieldControl
Types
Description

Render a button next to the select box to reset a changed selection to the state before it was manipulated by the user.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

selectIcons

selectIcons
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['selectIcons']
Scope
fieldWizard

Render thumbnails of icons below the select drop-down. Disabled by default.

fileFolderConfig

fileFolderConfig

allowedExtensions

allowedExtensions
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['allowedExtensions']
Scope
Display / Proc.

List of file extensions to select. If blank, all files are selected. Specify list in lowercase.

This configuration can be overridden by Page TSconfig.

depth

depth
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['depth']
Scope
Display / Proc.
RenderType
all

Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. Only useful in combination with property folder.

This configuration can be overridden by Page TSconfig.

folder

folder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['folder']
Scope
Display / Proc.

Specifying a folder from where files are added to the item array.

Specify the folder relative to the \TYPO3\CMS\Core\Core\Environment::getPublicPath(). See getPublicPath() . Alternatively use the prefix "EXT:" to point to an extension folder.

Files from the folder are selected recursively to the level specified by depth and only files of the extensions defined by allowedExtensions are listed in the select box.

Only the file reference relative to the folder is stored.

If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array).

This configuration can be overridden by Page TSconfig.

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma separated list by default.

Use property MM <columns-select-byside-properties-mm> to store the values in an intermediate MM table instead.

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

Label prefix to the title of the records from the foreign-table.

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The items from foreign_table are selected with this WHERE clause. The WHERE clause is effectively appended to the existing WHERE clause (which contains default constraints, such as NOT deleted) and must begin with AND.

See also foreign_table.

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains the elements for the selector box unless the property foreign_table or special has been set in which case automated values are set in addition to any values listed in this array.

Changed in version 13.0

Auto-registration of New content element wizard via TCA introduced. If your extension supports both TYPO3 v12 and v13, keep the page TSconfig option newContentElement.wizardItems until dropping TYPO3 v12 support.

Items registered for the field CType of table tt_content get automatically added to the New content element wizard. Settings from the items property can be overridden via page TSconfig newContentElement.wizardItems.

See also Add content elements to the Content Element Wizard.

Each element in this array is in itself an associative array.

label (string or LLL reference)
The displayed title.
value (integer or string)

The value stored in the database.

  • Values must not contain , (comma) and | (vertical bar). If you want to use authMode, you should
    also refrain from using : (colon).
icon (EXT: path or icon identifier)
Optional icon. For custom icons use a path prepended with EXT: to refer to an image file found inside an extension or use an registered icon identifier. If configured on the foreign_table, selicon-field is respected.
description (string or array)
Fifth value is an optional description text. This is only shown when the list is shown with renderType='selectCheckBox'.

For example see Side-by-side view with filter.

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

PHP method which is called to fill or manipulate the items array. See itemsProcFunc about details.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_match_fields

MM_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

In a MM bidirectional relation using match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiSelectFilterItems

multiSelectFilterItems
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Contains predefined elements for the filter field. On selecting an item, the list of available items gets automatically filtered.

Each element in this array is in itself an array where:

  • First value is the filter value of the item .
  • Second value is the item label (string or LLL reference)
Example: Select by predefined keywords
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_5' => [
            'label' => 'select_multiplesidebyside_5 multiSelectFilterItems',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'bar',
                        'value' => 4,
                    ],
                ],
                'multiSelectFilterItems' => [
                    [
                        '',
                        '',
                    ],
                    [
                        'foo',
                        'foo',
                    ],
                    [
                        'bar',
                        'bar',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
1

If set to 1 (default), displays a select drop-down, else a select box of given size.

Advanced examples for multiple side-by-side select boxes

See also: tca_example_select_multiplesidebyside_1.

Side-by-side view with filter

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_5' => [
            'label' => 'select_multiplesidebyside_5 multiSelectFilterItems',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'items' => [
                    [
                        'label' => 'foo 1',
                        'value' => 1,
                    ],
                    [
                        'label' => 'foo 2',
                        'value' => 2,
                    ],
                    [
                        'label' => 'foo 3',
                        'value' => 3,
                    ],
                    [
                        'label' => 'bar',
                        'value' => 4,
                    ],
                ],
                'multiSelectFilterItems' => [
                    [
                        '',
                        '',
                    ],
                    [
                        'foo',
                        'foo',
                    ],
                    [
                        'bar',
                        'bar',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Side-by-side select with field controls

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_6' => [
            'label' => 'select_multiplesidebyside_6 fieldControl',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'size' => 5,
                'autoSizeMax' => 20,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                        'options' => [
                            'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
                        ],
                    ],
                    'addRecord' => [
                        'disabled' => false,
                    ],
                    'listModule' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Using a MM table

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_multiplesidebyside_8' => [
            'label' => 'select_multiplesidebyside_8 foreign_table mm',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_styleguide_staticdata',
                'MM' => 'tx_styleguide_elements_select_multiplesidebyside_8_mm',
                'size' => 3,
                'autoSizeMax' => 10,
            ],
        ],
    ],
]
Copied!

selectTree

The selectTree render type is used to display hierarchical data in a tree structure.

The according database field is generated automatically.

A field with the selectTree render type allows you to represent data in a hierarchical manner, similar to a tree. It is typically used when working with database tables that have a hierarchical structure. The properties treeConfig and foreign_table are mandatory and must be provided to establish the connection to the relevant database table. Optionally, you can also use items or itemsProcFunc to pass the values, but these are not sufficient on their own. The top-level item in the tree will always represent the descriptive name of the table.

Regarding joining several tables, the selectTree render type can handle multiple tables through the configuration options.

Example: A happy little tree!

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_tree_1' => [
            'label' => 'select_tree_1 pages, showHeader=true, expandAll=true, size=20, order by sorting, static items, description',
            'description' => 'field description',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectTree',
                'foreign_table' => 'pages',
                'foreign_table_where' => 'ORDER BY pages.sorting',
                'size' => 20,
                'items' => [
                    [
                        'label' => 'static from tca 4711',
                        'value' => 4711,
                    ],
                    [
                        'label' => 'static from tca 4712',
                        'value' => 4712,
                    ],
                ],
                'behaviour' => [
                    'allowLanguageSynchronization' => true,
                ],
                'treeConfig' => [
                    'parentField' => 'pid',
                    'appearance' => [
                        'expandAll' => true,
                        'showHeader' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type select with renderType selectTree

Name Type Scope
boolean Proc.
string (keyword) Display / Proc.
boolean Proc.
integer Proc.
string Display / Proc.
boolean Display
string (list of) Display / Proc.
array
string Display / Proc.
integer Display / Proc.
string Display / Proc.
string (table name) Proc. / Display
string (column name) Proc. / Display
string or LLL reference Display
string (SQL WHERE) Proc. / Display
array Display / Proc.
string (class->method reference) Display / Proc.
integer > 0 Display / Proc.
integer > 0 Display
string (table name) Proc.
array Display / Proc.
string (field name) Proc.
array Proc.
string (SQL WHERE) Proc.
boolean Display / Proc.
boolean Display
integer Display
array Display
string (fully qualified class name)
string
string
string (comma separated values)
array
boolean
boolean
integer
string (comma separated list)

allowNonIdValues

allowNonIdValues
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
RenderType
all

Only useful if foreign_table is enabled.

If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list.

authMode

authMode
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Authorization mode for the selector box. The only possible option is:

explicitAllow
All static values from the "items" array of the selector box will be added to a matrix in the backend user configuration where a value must be explicitly selected if a user (other than admin) is allowed to use it!)
Migration: Using authMode='explicitDeny'

The "deny list" approach for single field values has been removed, the only allowed option for authMode is explicitAllow. Extensions using config value explicitDeny should be adapted to switch to explicitAllow instead. The upgrade wizard "Migrate backend groups "explicit_allowdeny" field to simplified format." that transfers existing be_groups rows to the new format, drops any DENY fields and instructs admins to not set new access rights of affected backend groups.

Migration: Using authMode='individual'

Handling of authMode being set to individual has been fully dropped. The Core provides no alternative. This has been an obscure setting ever since and there is no direct migration. Extensions that rely on this handling need to find a substitution based on Core hooks, Core events or other existing Core API functionality.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$selectField = [
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingleBox',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

dbFieldLength

dbFieldLength
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
255
Scope
Proc.

New in version 13.0

The TCA config option dbFieldLength contains an integer value that is applied to varchar fields (not text) and defines the length of the database field. It will not be respected for fields that resolve to an integer type. Developers who wish to optimize field length can use dbFieldLength for type=select fields to increase or decrease the default length.

Example: Increase the dbFieldLength for a select field
Excerpt from EXT:my_extension/Configuration/TCA/myextension_domain_model_mytable.php
<?php

$selectField = [
    'label' => 'My field',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingleBox',
        'items' => [
            ['label' => '', 'value' => ''],
            ['label' => 'Some label', 'value' => 'some'],
            ['label' => 'Another label', 'value' => 'another'],
        ],
        'default' => '',
        'dbFieldLength' => 10,
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Default value set if a new record is created. If empty, the first element in the items array is selected.

disableNoMatchingValueElement

disableNoMatchingValueElement
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

If set, then no element is inserted if the current value does not match any of the existing elements. A corresponding options is also found in Page TSconfig.

exclusiveKeys

exclusiveKeys
Type
string (list of)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

List of keys that exclude any other keys in a select box where multiple items could be selected.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

fileFolderConfig

fileFolderConfig

allowedExtensions

allowedExtensions
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['allowedExtensions']
Scope
Display / Proc.

List of file extensions to select. If blank, all files are selected. Specify list in lowercase.

This configuration can be overridden by Page TSconfig.

depth

depth
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['depth']
Scope
Display / Proc.
RenderType
all

Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. Only useful in combination with property folder.

This configuration can be overridden by Page TSconfig.

folder

folder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fileFolderConfig']['folder']
Scope
Display / Proc.

Specifying a folder from where files are added to the item array.

Specify the folder relative to the \TYPO3\CMS\Core\Core\Environment::getPublicPath(). See getPublicPath() . Alternatively use the prefix "EXT:" to point to an extension folder.

Files from the folder are selected recursively to the level specified by depth and only files of the extensions defined by allowedExtensions are listed in the select box.

Only the file reference relative to the folder is stored.

If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array).

This configuration can be overridden by Page TSconfig.

Examples: Select SVGs recursively from a folder
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_7' => [
            'label' => 'select_single_7 fileFolder, dummy first entry, selectIcons',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => '',
                        'value' => 0,
                    ],
                ],
                'fileFolderConfig' => [
                    'folder' => 'EXT:styleguide/Resources/Public/Icons',
                    'allowedExtensions' => 'svg',
                    'depth' => 1,
                ],
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

foreign_table

foreign_table
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The item-array will be filled with records from the table defined here. The table must have a TCA definition.

The uids of the chosen records will be saved in a comma separated list by default.

Use property MM <columns-select-tree-properties-mm> to store the values in an intermediate MM table instead.

Example: Select singe field with enabled selectIcons
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!
Example: Select field with foreign table via MM table
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_15' => [
            'label' => 'select_single_15 foreign_table',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_staticdata',
                'MM' => 'tx_styleguide_elements_select_single_15_mm',
            ],
        ],
    ],
]
Copied!

foreign_table_item_group

foreign_table_item_group
Type
string (column name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

New in version 13.0

This property references a specific field in the foreign table, which holds an item group identifier.

See also foreign_table_item_group.

foreign_table_prefix

foreign_table_prefix
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
all

Label prefix to the title of the records from the foreign-table.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

foreign_table_where

foreign_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
RenderType
all

The items from foreign_table are selected with this WHERE clause. The WHERE clause is effectively appended to the existing WHERE clause (which contains default constraints, such as NOT deleted) and must begin with AND.

Field quoting

The example below uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible. Note that ORDER BY and GROUP BY should NOT be quoted, since they always receive proper quoting automatically through the API.

Markers inside the WHERE statement

It is possible to use markers in the WHERE clause:

###REC_FIELD_[field name]###

Any field of the current record.

###THIS_UID###
Current element uid (zero if new).
###CURRENT_PID###
The current page id (pid of the record).

###SITEROOT###

###PAGE_TSCONFIG_ID###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_IDLIST###
A value you can set from Page TSconfig dynamically.
###PAGE_TSCONFIG_STR###
A value you can set from Page TSconfig dynamically.
###SITE:<KEY>.<SUBKEY>###
A value from the site configuration, for example: ###SITE:mySetting.categoryPid### or ###SITE:rootPageId###.

The markers are preprocessed so that the value of CURRENT_PID and PAGE_TSCONFIG_ID are always integers (default is zero), PAGE_TSCONFIG_IDLIST will always be a comma-separated list of integers (default is zero) and PAGE_TSCONFIG_STR will be quoted before substitution (default is blank string).

More information about markers set by Page TSconfig can be found in the TSconfig reference.

Example: Select single field with foreign_prefix and foreign_where
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_3' => [
            'label' => 'select_single_3 static values, dividers, foreign_table_where',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Static values',
                        'value' => '--div--',
                    ],
                    [
                        'label' => 'static -2',
                        'value' => -2,
                    ],
                    [
                        'label' => 'static -1',
                        'value' => -1,
                    ],
                    [
                        'label' => 'DB values',
                        'value' => '--div--',
                    ],
                ],
                'foreign_table' => 'tx_styleguide_staticdata',
                'foreign_table_where' => 'AND {#tx_styleguide_staticdata}.{#value_1} LIKE \'%foo%\' ORDER BY uid',
                'foreign_table_prefix' => 'A prefix: ',
            ],
        ],
    ],
]
Copied!

items

items
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
all

Contains the elements for the selector box unless the property foreign_table or special has been set in which case automated values are set in addition to any values listed in this array.

For examples see also property items of singleSelect.

itemsProcFunc

itemsProcFunc
Type
string (class->method reference)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

PHP method which is called to fill or manipulate the items array. See itemsProcFunc about details.

maxitems

maxitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

minitems

minitems
Type
integer > 0
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.

MM

MM
Type
string (table name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

This value contains the name of the table in which to store a MM relation. It is used together with foreign_table.

The database field with a MM property only stores the number of records in the relation.

Please have a look into the additional information in the MM common property description.

MM_match_fields

MM_match_fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Array of field => value pairs to both insert and match against when writing/reading MM relations.

MM_opposite_field

MM_opposite_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

If you want to make a MM relation editable from the foreign side (bidirectional) of the relation as well, you need to set MM_opposite_field on the foreign side to the field name on the local side.

For example, if the field companies.employees is your local side and you want to make the same relation editable from the foreign side of the relation in a field called persons.employers, you would need to set the MM_opposite_field value of the TCA configuration of the persons.employers field to the string "employees".

MM_oppositeUsage

MM_oppositeUsage
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

In a MM bidirectional relation using match fields the opposite side needs to know about the match fields for certain operations (for example, when a copy is created in a workspace) so that relations are carried over with the correct information.

MM_oppositeUsage is an array which references which fields contain the references to the opposite side, so that they can be queried for match field configuration.

MM_table_where

MM_table_where
Type
string (SQL WHERE)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.

Additional where clause used when reading MM relations.

Example:

{#uid_local} = ###THIS_UID###
Copied!

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL-compatible as possible.

MM_hasUidField

MM_hasUidField

Changed in version 13.0

This setting is obsolete. Remove all occurrences of MM_hasUidField from TCA. The uid column is added as primary key automatically, if multiple = true is set, otherwise a combined primary key of fields uid_local, uid_foreign plus eventually tablenames and fieldname is used.

multiple

multiple
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

Allows the same item more than once in a list.

If used with bidirectional MM relations it must be set for both the native and foreign field configuration.

Changed in version 13.0

The property MM_hasUidField is obsolete. It had to be defined previously when using multiple.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Default
1

Maximal number of elements to be displayed in the tree by default

treeConfig

treeConfig
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']
Scope
Display

Either childrenField or parentField has to be set - childrenField takes precedence. Keywords:

dataProvider

dataProvider
Type
string (fully qualified class name)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['dataProvider']

Allows to define a custom data provider class for use cases where special data preparation is necessary. By default \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider is used.

childrenField

childrenField
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['childrenField']

Field name of the foreign_table that references the uid of the child records.

parentField

parentField
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['parentField']

Field name of the foreign_table that references the uid of the parent record

startingPoints

startingPoints
Type
string (comma separated values)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['startingPoints']

allows to set multiple records as roots for tree records.

The setting takes a CSV value, e.g. 2,3,4711, which takes records of the pids 2, 3 and 4711 into account and creates a tree of these records.

Additionally, each value used in startingPoints may be fed from a site configuration by using the ###SITE:### syntax.

This property can also be set by page TSconfig, see config.treeConfig

Example:

# Site config
base: /
rootPageId: 1
categories:
    root: 123
Copied!
// Example TCA config
'config' => [
     'treeConfig' => [
          'startingPoints' => '1,2,###SITE:categories.root###',
     ],
],
Copied!

appearance

appearance
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['']

showHeader

showHeader
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['appearance']['showHeader']

Whether to show the header of the tree that contains a field to filter the records and allows to expand or collapse all nodes

expandAll

expandAll
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['appearance']['expandAll']

Whether to show the tree with all nodes expanded

maxLevels

maxLevels
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['appearance']['maxLevels']

The maximal amount of levels to be rendered (can be used to stop possible recursions)

nonSelectableLevels

nonSelectableLevels
Type
string (comma separated list)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['treeConfig']['appearance']['nonSelectableLevels']
Default
0

Comma-separated list of levels that will not be selectable, by default the root node (which is "0") cannot be selected

Example: Tree with non selectable levels
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_tree_2' => [
            'label' => 'select_tree_2 pages, showHeader=false, nonSelectableLevels=0,1, maxitems=4, size=10',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectTree',
                'foreign_table' => 'pages',
                'maxitems' => 4,
                'size' => 10,
                'treeConfig' => [
                    'parentField' => 'pid',
                    'appearance' => [
                        'expandAll' => true,
                        'showHeader' => false,
                        'nonSelectableLevels' => '0,1',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Item group API methods

Adding custom select item groups

Registration of a select item group takes place in Configuration/TCA/tx_mytable.php for new TCA tables, and in Configuration/TCA/Overrides/a_random_core_table.php for modifying an existing TCA definition.

For existing select fields additional item groups can be added via the api method ExtensionManagementUtility::addTcaSelectItemGroup.

ExtensionManagementUtility::addTcaSelectItemGroup(
    'tt_content',
    'CType',
    'sliders',
    'LLL:EXT:my_slider_mixtape/Resources/Private/Language/locallang_tca.xlf:tt_content.group.sliders',
    'after:lists'
);
Copied!

When adding a new select field, itemGroups should be added directly in the original TCA definition without using the API method. Use the API within TCA/Configuration/Overrides/ files to extend an existing TCA select field with grouping.

Attaching select items to item groups

Using the API method ExtensionManagementUtility::addTcaSelectItem a a fourth parameter in the array can be used to specify the id of the item group.

ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    [
        'LLL:EXT:my_slider_mixtape/Resources/Private/Locallang/locallang_tca.xlf:tt_content.CType.slickslider',
        'slickslider',
        'EXT:my_slider_mixtape/Resources/Public/Icons/slickslider.png',
        'sliders'
    ]
);
Copied!

History

With the introduction of the itemGroups the TCA column type select has a clean API to group items for dropdowns in FormEngine. This was previously handled via placeholder --div-- items, which then rendered as <optgroup> HTML elements in a dropdown.

In larger installations or TYPO3 instances with lots of extensions, Plugins or Content Types (tt_content.CType), or custom Page Types (pages.doktype) drop down lists could grow large and adding item groups caused tedious work for developers or integrators. Grouping can now be configured on a per-item basis. Custom groups can be added via an API or when defining TCA for a new table.

Slugs / URL parts

The main purpose of this type is to define parts of a URL path to generate and resolve URLs. The according database field is generated automatically.

Example: A basic slug field

This example limits the length of the slug to 50 characters. It takes only the field input_1 into account for generating the slug.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_2' => [
            'label' => 'slug_2',
            'config' => [
                'type' => 'slug',
                'size' => 50,
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!

Example: A slug field with prefix hook

This example uses a custom slug prefix hook via config['appearance']['prefix'] to adapt the displayed prefix. It takes the two fields input_1 and input_2 into account for generating the slug.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_1' => [
            'label' => 'slug_1',
            'description' => 'field description',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                        'input_2',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                    'replacements' => [
                        '/' => '',
                    ],
                ],
                'appearance' => [
                    'prefix' => 'TYPO3\\CMS\\Styleguide\\UserFunctions\\FormEngine\\SlugPrefix->getPrefix',
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type slug

Name Type Scope
array Display
userFunction Display
string (list of keywords) Proc. / Display
string Proc. / Display
array Proc. / Display
array Proc. / Display
string Proc. / Display
boolean Proc. / Display
array Proc. / Display
array Proc. / Display
boolean Proc. / Display

appearance

appearance
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Properties that only apply to how the field is displayed in the backend.

prefix

prefix
Type
userFunction
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']
Scope
Display

Provides a string that is displayed in front of the input field. The URL of the site is set by default if nothing has been defined.

Assign a user function. It receives two arguments:

  • The first argument is the parameters array containing the site object, the language id, the current table and the current row.
  • The second argument is the reference object TcaSlug.

The user function should return the string which is then used for display purposes.

Example: Set a slug field prefix
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_1' => [
            'label' => 'slug_1',
            'description' => 'field description',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                        'input_2',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                    'replacements' => [
                        '/' => '',
                    ],
                ],
                'appearance' => [
                    'prefix' => 'TYPO3\\CMS\\Styleguide\\UserFunctions\\FormEngine\\SlugPrefix->getPrefix',
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!

The user function can be implemented like this:

<?php

declare(strict_types=1);

/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

namespace TYPO3\CMS\Styleguide\UserFunctions\FormEngine;

/**
 * A user function to compare two fields
 *
 * @internal
 */
use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSlug;

final class SlugPrefix
{
    public function getPrefix(array $parameters, TcaSlug $reference): string
    {
        return 'custom slug prefix';
    }
}
Copied!

eval

eval
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

Configuration of field evaluation.

Keywords:

unique
Evaluate if a record is unique in the whole TYPO3 installation (specific to a language). This option is recommended as it allows to show any record stored inside other sites. The only downside is that it is not possible to have the same slug on multiple sites.
uniqueInSite

Requires the field to be unique for the current site and language. This allows for multiple records of the same table to have the same slug as long as these records are separated by their sites. Consequently records of a foreign site are not accessible with uniqueInsite since slugs are looked up respecting the current site.

uniqueInPid
Requires the field to be unique for the current PID among other records on the same page.

No other eval setting is checked for. It is possible to set different eval options, however it is recommended not to do so.

Example: eval = uniqueInSite
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_2' => [
            'label' => 'slug_2',
            'config' => [
                'type' => 'slug',
                'size' => 50,
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!

fallbackCharacter

fallbackCharacter
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display
Default
-

Character that represents the separator of slug sections, that contain the fieldSeparator.

Example: fallbackCharacter and fieldSeparator set
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_2' => [
            'label' => 'slug_2',
            'config' => [
                'type' => 'slug',
                'size' => 50,
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                    ],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!

generatorOptions

generatorOptions
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['']
Scope
Proc. / Display

Holds information about the record fields to be used for slug generation:

fields

fields
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['fields']
Scope
Proc. / Display

Insert several field names (of type string) that will be considered during slug construction.

Can also be used as nested array to combine multiple fields [['nav_title', 'title'], 'other_field'].

Examples:

Configuration value Values of an example page record Resulting slug
[['nav_title', 'title']] ['title' => 'Products', 'nav_title' => ''] /products
[['title', 'subtitle']] ['title' => 'Products', 'subtitle' => 'Product subtitle'] /products
['title', 'subtitle'] or [['title'], ['subtitle']] ['title' => 'Products', 'subtitle' => 'Product subtitle'] /products/product-subtitle
['nav_title', 'title'], 'subtitle' ['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle'] /best-products/product-subtitle
['seo_title', 'title'], ['nav_title', 'subtitle'] ['title' => 'Products', 'nav_title' => 'Best products', 'subtitle' => 'Product subtitle', 'seo_title' => 'SEO product title'] /seo-product-title/best-products

fieldSeparator

fieldSeparator
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['fieldSeparator']
Scope
Proc. / Display
Default
"/"

This value will divide the slug parts. If a section value contains this very value, it will be replaced by the value given in fallbackCharacter.

prefixParentPageSlug

prefixParentPageSlug
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['prefixParentPageSlug']
Default
true
Scope
Proc. / Display

The slugs of parent pages will be prefixed to the slug for the page itself. Disable it for shorter URLs, but take the higher chance of collision into consideration.

replacements

replacements
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['replacements']
Scope
Proc. / Display

It allows to replace strings of a slug part. Add one of more array items with the key being the string to replace and the value being the replacement string.

postModifiers

postModifiers
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['generatorOptions']['postModifiers']
Scope
Proc. / Display

The "slug" TCA type includes a possibility to hook into the generation of a slug via custom TCA generation options.

Hooks can be registered via:

EXT:myextension/Configuration/TCA/Overrides/table.php
$GLOBALS['TCA'][$tableName]['columns'][$fieldName]['config']['generatorOptions']['postModifiers'][]
    = MyClass::class . '->method';
Copied!

Consider $tableName = 'pages' and $fieldName = 'slug' inside EXT:my_extension/Configuration/TCA/Overrides/table.php:

EXT:myextension/Configuration/TCA/Overrides/table.php
$GLOBALS['TCA']['pages']['columns']['slug']['config']['generatorOptions']['postModifiers'][] =
    MyClass::class . '->modifySlug';
Copied!

The method then receives an parameter array with the following values

  [
      'slug', // ...  the slug to be used
      'workspaceId', // ...  the workspace ID, "0" if in live workspace
      'configuration', // ...  the configuration of the TCA field
      'record', // ...  the full record to be used
      'pid', // ...  the resolved parent page ID
      'prefix', // ...  the prefix that was added
      'tableName', // ...  the table of the slug field
      'fieldName', // ...  the field name of the slug field
];
Copied!

All hooks need to return the modified slug value.

Example: Generate a concatenated slug
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_4' => [
            'label' => 'slug_4',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => [
                        'input_1',
                        'input_2',
                    ],
                    'prefixParentPageSlug' => false,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!
Example: Generate a slug from one field with a backup field if first is empty
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_5' => [
            'label' => 'slug_5',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => [
                        [
                            'input_1',
                            'input_2',
                        ],
                    ],
                    'prefixParentPageSlug' => false,
                ],
                'fallbackCharacter' => '-',
                'eval' => 'uniqueInSite',
                'default' => '',
            ],
        ],
    ],
]
Copied!
Example: remove all strings "(f/m)" from job titles

This will change the provided slug 'Some Job in city1/city2 (f/m)' to 'some-job-in-city1-city2'.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_slugs.php
[
    'columns' => [
        'slug_3' => [
            'label' => 'slug_3',
            'description' => 'remove string (f/m)',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => [
                        'input_3',
                    ],
                    'replacements' => [
                        '(f/m)' => '',
                        '/' => '-',
                    ],
                ],
                'fallbackCharacter' => '-',
                'prependSlash' => true,
                'eval' => 'uniqueInPid',
            ],
        ],
    ],
]
Copied!

prependSlash

prependSlash
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc. / Display

Defines whether a slug field should contain a prepending slash, for example for nested categories with speaking segments.

If not set, this defaults to false. (Exception: for the pages.slug field this defaults to true and cannot be changed.)

Introduction

The main purpose of this type is to define parts of a URL path to generate and resolve URLs.

With a URL like https://www.typo3.org/ch/community/values/core-values/ a URL slug is typically a part like /community or /community/values/core-values.

Within TYPO3, a slug is always part of the URL "path" - it does not contain scheme, host, HTTP verb, etc.

A slug is usually added to a TCA-based database table, for example pages. The TCA then contains rules for evaluation and definition.

When applied to pages a hierarchy of pages is often represented by a combined slug: From each page the characteristic last part of its slug is used as path segment. The segments are combined into one slug, separated by slashes. The resulting URL's path is therefore similar to the file paths in common operating systems.

However, slugs in TYPO3 are not limited to be separated by slashes. It is possible to use other separators. Furthermore, a single path segment may contain any sign allowed in URLs, including slashes.

It is not required to build hierarchical paths. It is possible to assign a single, unique path segment to each page in a deep page hierarchy. In TYPO3 the only requirement is that the slug for each page in a domain must be unique.

If a TCA table contains a field called "slug", it needs to be filled for every existing record. It can be shown and edited via regular backend forms, and is also evaluated during persistence via DataHandler.

The default behaviour of a slug is as follows:

  • A slug only contains characters which are allowed within URLs. Spaces, commas and other special characters are converted to a fallback character.
  • A slug is always lower-cased.
  • A slug is unicode-aware.

It is possible to build a default value from the rootline (very helpful for pages, or categorized slugs), but also to just generate a "speaking" segment from e.g. a news title.

Sanitation and Validation configuration options apply when persisting a record via DataHandler.

In the backend forms a validation happens by an AJAX call, which immediately checks any input and receives a new proposal in case the slug is already used.

Text areas & RTE

New in version 13.0

The according database fields for all render types are generated automatically.

Introduction

The text type is for multi-line text input, in the database ext_tables.sql files it is typically set to a TEXT column type. In the backend, it is rendered in various shapes: It can be rendered as a simple <textarea>, as a rich text editor (RTE), as a code block with syntax highlighting, and others.

The following renderTypes are available:

  • default: A simple text area or a rich text field is rendered, if no renderType is specified.
  • belayoutwizard: The backend layout wizard is displayed in order to edit records of table backend_layout in the backend.
  • codeEditor: This render type triggers a code highlighter.

    Changed in version 13.0

    In previous TYPO3 versions, the code editor was available via the system extension "t3editor". The functionality was moved into the system extension "backend". The render type t3editor was renamed to codeEditor. A TCA migration from the old value to the new one is in place.

  • textTable: The renderType = 'textTable' triggers a view to manage frontend table display in the backend. It is used for the "table" tt_content content element.

Simple text area

A simple text area or a rich text field is rendered, if no renderType is specified.

See render type "default" on how to configure such an editor.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_4' => [
            'label' => 'text_4',
            'description' => 'cols=20, rows=2',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
]
Copied!

Rich text editor field

See property "enableRichtext" on how to configure such an editor.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_1' => [
            'label' => 'rte_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
            ],
        ],
    ],
]
Copied!

Code highlight editor

Code editor with highlighting HTML

Code editor with highlighting HTML

See codeEditor on how to configure such an editor.

[
    // ...
    'type' => 'text',
    'renderType' => 'codeEditor',
    // ...
]
Copied!

Backend layout editor

The backend layout wizard is displayed in order to edit records of table backend_layout in the backend.

See render type belayoutwizard on how to configure such an editor.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_20' => [
            'label' => 'text_20',
            'description' => 'renderType=belayoutwizard',
            'config' => [
                'type' => 'text',
                'renderType' => 'belayoutwizard',
                'default' => '
backend_layout {
  colCount = 2
  rowCount = 2
  rows {
    1 {
      columns {
        1 {
          name = Left
          rowspan = 2
          colPos = 1
        }
        2 {
          name = Main
          colPos = 0
        }
      }
    }
    2 {
      columns {
        1 {
          name = Footer
          colPos = 24
        }
      }
    }
  }
}',
            ],
        ],
    ],
]
Copied!

Text field with renderType textTable

The table wizard allows to edit the code-like configuration of the tables with a visual editor.

See render type textTable on how to configure such an editor.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_17' => [
            'label' => 'text_17',
            'description' => 'renderType=textTable',
            'config' => [
                'type' => 'text',
                'renderType' => 'textTable',
            ],
        ],
    ],
]
Copied!

text (multiline)

This page describes the text type with no renderType (default).

The according database field is generated automatically.

type='text' without a given specific renderType either renders a simple <textarea> or a Rich Text field if enableRichtext is enabled in TCA and page TSconfig.

Examples for multiline text fields

Multiline plain text area

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_4' => [
            'label' => 'text_4',
            'description' => 'cols=20, rows=2',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
]
Copied!

Rich text editor field

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_1' => [
            'label' => 'rte_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type text with or without enabled rich text

Name Type Scope
boolean Proc.
integer Display
string Display / Proc.
boolean Display / Proc.
boolean Display
string (list of keywords) Display / Proc.
array
array
array
boolean Display
string Display / Proc.
integer Display
integer Display
boolean Proc
string Display
boolean Display
boolean Display / Proc.
string (keyword) Display / Proc.
integer Display
array Search
boolean
boolean
string
string Proc.
string (keyword) Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$textTableField = [
    'config' => [
        'type' => 'text',
        'renderType' => 'textTable',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

cols

cols
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <textarea> field. To set the textarea to the full width of the form area, use the value 50. Default is 30.

Does not apply to RTE fields.

Example: A simple text editor with 20 width
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_4' => [
            'label' => 'text_4',
            'description' => 'cols=20, rows=2',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
]
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created.

enableRichtext

enableRichtext
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.

If set to true, the system renders a Rich Text Editor if that is enabled for the editor (default: yes), and if a suitable editor extension is loaded (default: rteckeditor).

If either of these requirements is not met, the system falls back to a <textarea> field.

Example: Rich text editor (RTE)
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_1' => [
            'label' => 'rte_1 description',
            'description' => 'field description',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
            ],
        ],
    ],
]
Copied!

enableTabulator

enableTabulator
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Enabling this allows to use tabs in a text field. This works well together with fixed-width fonts (monospace) for code editing.

Does not apply to RTE fields.

Example: Fixed font field with tabulators enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_15' => [
            'label' => 'text_15',
            'description' => 'enableTabulator, fixedFont',
            'config' => [
                'type' => 'text',
                'enableTabulator' => true,
                'fixedFont' => true,
            ],
        ],
    ],
]
Copied!

eval

eval
Type
string (list of keywords)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
default

Configuration of field evaluation. None of these apply for RTE fields.

Some of these evaluation keywords will trigger a JavaScript pre-evaluation in the form. Other evaluations will be performed in the backend.

The evaluation functions will be executed in the list-order, available keywords:

trim
The value in the field will have white spaces around it trimmed away.
Vendor\Extension\*
User defined form evaluations.
Example: Trimming input

Trimming the value for white space before storing in the database:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_7' => [
            'label' => 'text_7',
            'description' => 'eval=trim',
            'config' => [
                'type' => 'text',
                'eval' => 'trim',
            ],
        ],
    ],
]
Copied!
Example: Custom form evaluation
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_9' => [
            'label' => 'text_9',
            'description' => 'readOnly=1',
            'config' => [
                'type' => 'text',
                'readOnly' => 1,
            ],
        ],
    ],
]
Copied!

You can supply own form evaluations in an extension by creating a class with two functions: deevaluateFieldValue() called when opening the record and evaluateFieldValue() called for validation when saving the record:

EXT:styleguide/Classes/UserFunctions/FormEngine/TypeText9Eval.php

<?php

namespace TYPO3\CMS\Styleguide\UserFunctions\FormEngine;

class TypeText9Eval
{
    /**
     * Adds text "PHPfoo-evaluate" at end on saving
     */
    public function evaluateFieldValue(string $value, string $is_in, bool &$set): string
    {
        return $value . 'PHPfoo-evaluate';
    }

    /**
     * Adds text "PHPfoo-deevaluate" at end on opening
     */
    public function deevaluateFieldValue(array $parameters): string
    {
        $value = $parameters['value'];
        return $value . 'PHPfoo-deevaluate';
    }
}
Copied!
EXT:styleguide/ext_localconf.php
<?php

// Register the class to be available in 'eval' of TCA
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals']
['TYPO3\\CMS\\Styleguide\\UserFunctions\\FormEngine\\TypeText9Eval'] = '';
Copied!

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

fixedFont

fixedFont
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
default, textTable

Enables a fixed-width font (monospace) for the text field. This is useful when using code.

Does not apply to RTE fields.

Example: Fixed font field with tabulators enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_15' => [
            'label' => 'text_15',
            'description' => 'enableTabulator, fixedFont',
            'config' => [
                'type' => 'text',
                'enableTabulator' => true,
                'fixedFont' => true,
            ],
        ],
    ],
]
Copied!

is_in

is_in
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
textTable, default

If a user-defined evaluation is used for the field (see eval), then this value will be passed as argument to the user-defined evaluation function.

Does not apply to RTE fields.

max

max
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, default

Adds the HTML5 attribute "maxlength" to a textarea. Prevents the field from adding more than specified number of characters. This is a client side restriction, no server side length restriction is enforced.

Does not apply for RTE fields.

Example: Textarea with a maximum of 30 characters
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_11' => [
            'label' => 'text_11',
            'description' => 'max=30',
            'config' => [
                'type' => 'text',
                'cols' => 30,
                'rows' => 4,
                'max' => 30,
            ],
        ],
    ],
]
Copied!

min

min
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

This option allows to define a minimum number of characters for the <input> field and adds a minlength attribute to the field. If at least one character is typed in and the number of characters is less than min, the FormEngine marks the field as invalid, preventing the user to save the element. DataHandler will also take care for server-side validation and reset the value to an empty string, if min is not reached.

When using min in combination with , one has to make sure, the min value is less than or equal max. Otherwise the option is ignored.

Empty fields are not validated. If one needs to have non-empty values, it is recommended to use required => true in combination with min.

nullable

nullable
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Default
false
Scope
Proc

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL.

The database field must allow the NULL value.

Example: A nullable text editor
EXT:some_extension/Configuration/TCA/tx_sometable.php
<?php

$textTableField = [
    'title' => 'A nullable field',
    'config' => [
        'type' => 'text',
        'nullable' => true,
    ],
];
Copied!

placeholder

placeholder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
input

Placeholder text for the field.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

richtextConfiguration

richtextConfiguration
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
default

The value is a key in $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets'] array and specifies the YAML configuration source field used for that RTE field. It does not make sense without having property enableRichtext set to true.

Extension rte_ckeditor registers three presets: default, minimal and full and points to YAML files with configuration details.

Integrators may override for instance the default key to point to an own YAML file which will affect all core backend RTE instances to use that configuration.

If this property is not specified for an RTE field, the system will fall back to the default configuration. The preset can be overridden with page TSconfig RTE.

See also Examples for Rich text editor fields in the TYPO3 Backend.

rows

rows
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, codeEditor, default

The number of rows in the textarea. May be corrected for harmonization between browsers. Will also automatically be increased if the content in the field is found to be of a certain length, thus the field will automatically fit the content. Default is 5. Max value is 20.

Does not apply to RTE fields.

A simple text editor with 20 width .. include:: /Images/Rst/Text4.rst.txt

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_4' => [
            'label' => 'text_4',
            'description' => 'cols=20, rows=2',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
]
Copied!

search

Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
Scope
Search
Types
input

Defines additional search-related options for a given field.

pidonly

pidonly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']

Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.

case

case
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']

Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.

andWhere

andWhere
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']

Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched

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

$temporaryColumns['my_editor'] = [
    'config' => [
        'type' => 'text',
        'renderType' => 'textTable',
        'search' => [
            'andWhere' => '{#type}=\'type_x\' OR {#type}=\'type_y\'',
        ],
    ],
];
Copied!

This means that the "my_editor" field of the "tx_mytable" table will be searched in only for elements of type X and Y. This helps making any search more relevant.

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL compatible as possible.

softref

softref
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
input

Used to attach "soft reference parsers".

The syntax for this value is key1,key2[parameter1;parameter2;...],...

See Soft references of core API for more details about softref keys.

wrap

wrap
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, default

Determines the wrapping of the textarea field. Does not apply to RTE fields. There are two options:

virtual (default)
The textarea automatically wraps the lines like it would be expected for editing a text.
off
The textarea will not wrap the lines as you would expect when editing some kind of code.

Examples .. _tca_example_text_5:

Textarea with no wraping

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_5' => [
            'label' => 'text_5',
            'description' => 'wrap=off, long default text',
            'config' => [
                'type' => 'text',
                'wrap' => 'off',
                'default' => 'This textbox has wrap set to "off", so these long paragraphs should appear in one line: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non luctus elit. In sed nunc velit. Donec gravida eros sollicitudin ligula mollis id eleifend mauris laoreet. Donec turpis magna, pulvinar id pretium eu, blandit et nisi. Nulla facilisi. Vivamus pharetra orci sed nunc auctor condimentum. Aenean volutpat posuere scelerisque. Nullam sed dolor justo. Pellentesque id tellus nunc, id sodales diam. Sed rhoncus risus a enim lacinia tincidunt. Aliquam ut neque augue.',
            ],
        ],
    ],
]
Copied!

Textarea with virtual wraping

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_6' => [
            'label' => 'text_6',
            'description' => 'wrap=virtual, long default text',
            'config' => [
                'type' => 'text',
                'wrap' => 'virtual',
                'default' => 'This textbox has wrap set to "virtual", so these long paragraphs should appear in multiple lines (wrapped at the end of the textbox): Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non luctus elit. In sed nunc velit. Donec gravida eros sollicitudin ligula mollis id eleifend mauris laoreet. Donec turpis magna, pulvinar id pretium eu, blandit et nisi. Nulla facilisi. Vivamus pharetra orci sed nunc auctor condimentum. Aenean volutpat posuere scelerisque. Nullam sed dolor justo. Pellentesque id tellus nunc, id sodales diam. Sed rhoncus risus a enim lacinia tincidunt. Aliquam ut neque augue.',
            ],
        ],
    ],
]
Copied!

Rich text editor (RTE)

The RTE is by default supplied by the system extension typo3/cms-rte-ckeditor . See also the according chapter in TYPO3 explained.

In TCA a RTE is a normal text field with the option enableRichtext enabled.

Examples for Rich text editor fields in the TYPO3 Backend

RTE with minimal configuration

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_4' => [
            'label' => 'rte_4 richtextConfiguration=minimal',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
                'richtextConfiguration' => 'minimal',
            ],
        ],
    ],
]
Copied!

RTE with full configuration

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_5' => [
            'label' => 'rte_5 richtextConfiguration=full',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
                'richtextConfiguration' => 'full',
            ],
        ],
    ],
]
Copied!

RTE with default configuration

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_rte.php
[
    'columns' => [
        'rte_2' => [
            'label' => 'rte_2 default value',
            'config' => [
                'type' => 'text',
                'default' => 'rte_2',
                'enableRichtext' => true,
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type text with enabled rich text

Almost all properties of field type text are available.

belayoutwizard

This page describes the text type with renderType='belayoutwizard'.

The according database field is generated automatically.

The renderType = 'belayoutwizard' is a special renderType to display the backend layout wizard when editing records of table backend_layout in the backend. It is stored a custom syntax representing the page layout in the database.

Example: Backend layout editor

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_20' => [
            'label' => 'text_20',
            'description' => 'renderType=belayoutwizard',
            'config' => [
                'type' => 'text',
                'renderType' => 'belayoutwizard',
                'default' => '
backend_layout {
  colCount = 2
  rowCount = 2
  rows {
    1 {
      columns {
        1 {
          name = Left
          rowspan = 2
          colPos = 1
        }
        2 {
          name = Main
          colPos = 0
        }
      }
    }
    2 {
      columns {
        1 {
          name = Footer
          colPos = 24
        }
      }
    }
  }
}',
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type text, render type belayoutwizard

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no text-belayout gets selected.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

codeEditor (previously "t3editor")

Changed in version 13.0

This page describes the text type with the renderType='codeEditor'.

The renderType='codeEditor' triggers a code highlighter.

The according database field is generated automatically.

The code editor provides an enhanced textarea for TypoScript input, with not only syntax highlighting, but also autocomplete suggestions. Beyond that the code editor makes it possible to add syntax highlighting to textarea fields for several languages.

Example: Code highlighting with code editor

Code editor with highlighting HTML

Code editor with highlighting HTML

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

$temporaryColumns['my_editor'] = [
    'label' => 'My HTML Editor',
    'description' => 'field description',
    'config' => [
        'type' => 'text',
        'renderType' => 'codeEditor',
        'format' => 'html',
        'rows' => 7,
    ],
];
Copied!

Properties of the TCA column type text, render type codeEditor

Name Type Scope
boolean Proc.
array
array
array
string (keyword) Display
boolean Display
integer Display
array Search
boolean
boolean
string
string Proc.

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$textT3editorField = [
    'config' => [
        'type' => 'text',
        'renderType' => 't3editor',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

format

format

format
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The value specifies the language the code editor should handle. Allowed values:

  • css
  • html
  • javascript
  • php
  • typoscript
  • xml

See also Example: Code highlighting with code editor.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

rows

rows
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The number of rows in the textarea. May be corrected for harmonization between browsers. Will also automatically be increased if the content in the field is found to be of a certain length, thus the field will automatically fit the content. Default is 5. Max value is 20.

search

Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
Scope
Search
Types
input

Defines additional search-related options for a given field.

pidonly

pidonly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']

Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.

case

case
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']

Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.

andWhere

andWhere
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']

Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched

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

$textT3editorField = [
    'config' => [
        'type' => 'text',
        'renderType' => 't3editor',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

This means that the "my_editor" field of the "tx_mytable" table will be searched in only for elements of type X and Y. This helps making any search more relevant.

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL compatible as possible.

softref

softref
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
input

Used to attach "soft reference parsers".

The syntax for this value is key1,key2[parameter1;parameter2;...],...

See Soft references of core API for more details about softref keys.

Migration from render type t3editor to render type codeEditor

The migration from render type t3editor to render type codeEditor is pretty straight forward: Replace the render type. All other properties stayed the same.


  $temporaryColumns['my_editor'] = [
      'label' => 'My HTML Editor',
      'description' => 'field description',
      'config' => [
          'type' => 'text',
-         'renderType' => 't3editor',
+         'renderType' => 'codeEditor',
          'format' => 'html',
          'rows' => 7,
      ],
  ];
Copied!

textTable

This page describes the text type with the renderType='textTable'.

The according database field is generated automatically.

The textTable render type triggers a view called "table wizard" to manage the frontend table display in the backend. It is used for the "Table" tt_content content element.

Example: Text field with renderType textTable

The table wizard allows to edit the code-like configuration of the tables with a visual editor.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_17' => [
            'label' => 'text_17',
            'description' => 'renderType=textTable',
            'config' => [
                'type' => 'text',
                'renderType' => 'textTable',
            ],
        ],
    ],
]
Copied!

Properties of the TCA column type text, render type textTable

Name Type Scope
boolean Proc.
string Display / Proc.
boolean Display
array
array
array
boolean Display
string Display / Proc.
integer Display
string Display
boolean Display
integer Display
array Search
boolean
boolean
string
string Proc.
string (keyword) Display

behaviour

behaviour

allowLanguageSynchronization

allowLanguageSynchronization
Type
boolean
Default
false
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

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

$textTableField = [
    'config' => [
        'type' => 'text',
        'renderType' => 'textTable',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

default

default
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created.

enableTabulator

enableTabulator
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
default, textTable

Enabling this allows to use tabs in a text field. This works well together with fixed-width fonts (monospace) for code editing.

Does not apply to RTE fields.

Example: Fixed font field with tabulators enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_15' => [
            'label' => 'text_15',
            'description' => 'enableTabulator, fixedFont',
            'config' => [
                'type' => 'text',
                'enableTabulator' => true,
                'fixedFont' => true,
            ],
        ],
    ],
]
Copied!

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

defaultLanguageDifferences
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector

localizationStateSelector
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent

otherLanguageContent
Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

fixedFont

fixedFont
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
default, textTable

Enables a fixed-width font (monospace) for the text field. This is useful when using code.

Does not apply to RTE fields.

Example: Fixed font field with tabulators enabled
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_15' => [
            'label' => 'text_15',
            'description' => 'enableTabulator, fixedFont',
            'config' => [
                'type' => 'text',
                'enableTabulator' => true,
                'fixedFont' => true,
            ],
        ],
    ],
]
Copied!

is_in

is_in
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
RenderType
textTable, default

If a user-defined evaluation is used for the field (see eval), then this value will be passed as argument to the user-defined evaluation function.

Does not apply to RTE fields.

max

max
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, default

Adds the HTML5 attribute "maxlength" to a textarea. Prevents the field from adding more than specified number of characters. This is a client side restriction, no server side length restriction is enforced.

Does not apply for RTE fields.

Example: Textarea with a maximum of 30 characters
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_11' => [
            'label' => 'text_11',
            'description' => 'max=30',
            'config' => [
                'type' => 'text',
                'cols' => 30,
                'rows' => 4,
                'max' => 30,
            ],
        ],
    ],
]
Copied!

placeholder

placeholder
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
Types
input

Placeholder text for the field.

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

rows

rows
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, codeEditor, default

The number of rows in the textarea. May be corrected for harmonization between browsers. Will also automatically be increased if the content in the field is found to be of a certain length, thus the field will automatically fit the content. Default is 5. Max value is 20.

Does not apply to RTE fields.

Example: A simple text editor with 20 width
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_4' => [
            'label' => 'text_4',
            'description' => 'cols=20, rows=2',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
]
Copied!

search

Type
array
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
Scope
Search
Types
input

Defines additional search-related options for a given field.

pidonly

pidonly
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']

Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.

case

case
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']

Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.

andWhere

andWhere
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']

Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched

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

$temporaryColumns['my_editor'] = [
    'config' => [
        'type' => 'text',
        'renderType' => 'textTable',
        'search' => [
            'andWhere' => '{#type}=\'type_x\' OR {#type}=\'type_y\'',
        ],
    ],
];
Copied!

This means that the "my_editor" field of the "tx_mytable" table will be searched in only for elements of type X and Y. This helps making any search more relevant.

The above example uses the special field quoting syntax {#...} around identifiers to be as DBAL compatible as possible.

softref

softref
Type
string
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Proc.
Types
input

Used to attach "soft reference parsers".

The syntax for this value is key1,key2[parameter1;parameter2;...],...

See Soft references of core API for more details about softref keys.

wrap

wrap
Type
string (keyword)
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display
RenderType
textTable, default

Determines the wrapping of the textarea field. Does not apply to RTE fields. There are two options:

virtual (default)
The textarea automatically wraps the lines like it would be expected for editing a text.
off
The textarea will not wrap the lines as you would expect when editing some kind of code.
Example: Textarea with no wrapping
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_5' => [
            'label' => 'text_5',
            'description' => 'wrap=off, long default text',
            'config' => [
                'type' => 'text',
                'wrap' => 'off',
                'default' => 'This textbox has wrap set to "off", so these long paragraphs should appear in one line: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non luctus elit. In sed nunc velit. Donec gravida eros sollicitudin ligula mollis id eleifend mauris laoreet. Donec turpis magna, pulvinar id pretium eu, blandit et nisi. Nulla facilisi. Vivamus pharetra orci sed nunc auctor condimentum. Aenean volutpat posuere scelerisque. Nullam sed dolor justo. Pellentesque id tellus nunc, id sodales diam. Sed rhoncus risus a enim lacinia tincidunt. Aliquam ut neque augue.',
            ],
        ],
    ],
]
Copied!
Example: Textarea with virtual wrapping
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'text_6' => [
            'label' => 'text_6',
            'description' => 'wrap=virtual, long default text',
            'config' => [
                'type' => 'text',
                'wrap' => 'virtual',
                'default' => 'This textbox has wrap set to "virtual", so these long paragraphs should appear in multiple lines (wrapped at the end of the textbox): Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non luctus elit. In sed nunc velit. Donec gravida eros sollicitudin ligula mollis id eleifend mauris laoreet. Donec turpis magna, pulvinar id pretium eu, blandit et nisi. Nulla facilisi. Vivamus pharetra orci sed nunc auctor condimentum. Aenean volutpat posuere scelerisque. Nullam sed dolor justo. Pellentesque id tellus nunc, id sodales diam. Sed rhoncus risus a enim lacinia tincidunt. Aliquam ut neque augue.',
            ],
        ],
    ],
]
Copied!

Custom inputs (user)

Table of contents:

Introduction

There are three columns config types that do similar things, but still have subtle differences between them. These are the none type, the passthrough type and the user type.

Characteristics of user:

  • A value sent to the DataHandler is just kept as is and put into the database field. Default FormEngine however never sends values.
  • Unlike none, the type user must have a database field.
  • FormEngine only renders a dummy element for type user fields by default. It should be combined with a custom renderType.
  • Type user field values are rendered as-is at other places in the backend. They for instance can be selected to be displayed in the list module "single table view".
  • Field updates by the DataHandler get logged and the history/undo function will work with such values.

The user field can be useful, if:

  • A special rendering and evaluation is needed for a value when editing records via FormEngine.

Examples

This example is part of the TYPO3 Documentation Team extension t3docs/examples .

The example registers an own node element, a TCA field using it and a class implementing a rendering. See FormEngine docs for more details on this.

  1. Register the new renderType node element

    Add to ext_localconf.php:

    EXT:my_extension/ext_localconf.php
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][<current timestamp>] = [
        'nodeName' => 'specialField',
        'priority' => 40,
        'class' => \MyVendor\MyExtension\Form\Element\SpecialFieldElement::class,
    ];
    Copied!
  2. Use the renderType in a TCA field definition

    Add the field to the TCA definition, here in Configuration/TCA/Overrides/fe_users.php:

    EXT:my_extension/Configuration/TCA/Overrides/fe_users.php
    <?php
    
    defined('TYPO3') or die();
    
    $tempColumns = [
        'tx_myextension_special' => [
            'label' => 'My label',
            'config' => [
                'type' => 'user',
                // renderType needs to be registered in ext_localconf.php
                'renderType' => 'specialField',
                'parameters' => [
                    'size' => '30',
                    'color' => '#F49700',
                ],
            ],
        ],
    ];
    
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
        'fe_users',
        $tempColumns
    );
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
        'fe_users',
        'tx_myextension_special',
    );
    
    Copied!
  3. Implement the FormElement class

    The renderType can be implemented by extending the class AbstractFormElement and overriding the function render():

    EXT:my_extension/Classes/Form/Element/SpecialFieldElement.php
    <?php
    
    declare(strict_types=1);
    
    namespace MyVendor\MyExtension\Form\Element;
    
    use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
    use TYPO3\CMS\Core\Utility\GeneralUtility;
    use TYPO3\CMS\Core\Utility\StringUtility;
    
    class SpecialFieldElement extends AbstractFormElement
    {
        public function render(): array
        {
            $row = $this->data['databaseRow'];
            $parameterArray = $this->data['parameterArray'];
            $color = $parameterArray['fieldConf']['config']['parameters']['color'];
            $size = $parameterArray['fieldConf']['config']['parameters']['size'];
    
            $fieldInformationResult = $this->renderFieldInformation();
            $fieldInformationHtml = $fieldInformationResult['html'];
            $resultArray = $this->mergeChildReturnIntoExistingResult($this->initializeResultArray(), $fieldInformationResult, false);
    
            $fieldId = StringUtility::getUniqueId('formengine-textarea-');
    
            $attributes = [
                'id' => $fieldId,
                'name' => htmlspecialchars($parameterArray['itemFormElName']),
                'size' => $size,
                'data-formengine-input-name' => htmlspecialchars($parameterArray['itemFormElName']),
            ];
    
            $attributes['placeholder'] = 'Enter special value for user "' . htmlspecialchars(trim($row['username'])) .
                '" in size ' . $size;
            $classes = [
                'form-control',
                't3js-formengine-textarea',
                'formengine-textarea',
            ];
            $itemValue = $parameterArray['itemFormElValue'];
            $attributes['class'] = implode(' ', $classes);
    
            $html = [];
            $html[] = $this->renderLabel($fieldId);
            $html[] = '<div class="formengine-field-item t3js-formengine-field-item" style="padding: 5px; background-color: ' . $color . ';">';
            $html[] = $fieldInformationHtml;
            $html[] =   '<div class="form-wizards-wrap">';
            $html[] =      '<div class="form-wizards-element">';
            $html[] =         '<div class="form-control-wrap">';
            $html[] =            '<input type="text" value="' . htmlspecialchars($itemValue, ENT_QUOTES) . '" ';
            $html[] =               GeneralUtility::implodeAttributes($attributes, true);
            $html[] =            ' />';
            $html[] =         '</div>';
            $html[] =      '</div>';
            $html[] =   '</div>';
            $html[] = '</div>';
            $resultArray['html'] = implode(LF, $html);
    
            return $resultArray;
        }
    }
    
    Copied!

    Changed in version 13.3

    The label of a custom field does not get rendered automatically anymore but must be rendered with $this->renderLabel($fieldId) or $this->wrapWithFieldsetAndLegend().

    Migration

    If the custom field is used with TYPO3 v13, add $this->renderLabel($fieldId) to the output. If your extension should be compatible with both TYPO3 v12.4 and v13 make a version check first and only add this for major versions larger then 12.

    EXT:my_extension/Classes/Form/Element/SpecialFieldElement.php
             $attributes['class'] = implode(' ', $classes);
     
             $html = [];
    +        $versionInformation = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class);
    +        if ($versionInformation->getMajorVersion() > 12) {
    +            $html[] = $this->renderLabel($fieldId);
    +        }
             $html[] = '<div class="formengine-field-item t3js-formengine-field-item" style="padding: 5px; background-color: ' . $color . ';">';
             $html[] = $fieldInformationHtml;
             $html[] =   '<div class="form-wizards-wrap">';
    
    Copied!

    The array $this->data consists of the following parts:

    • The row of the currently edited record in $this->data['databaseRow']
    • The configuration from the TCA in $this->data['parameterArray']['fieldConf']['config']
    • The name of the input field in $this->data['parameterArray']['itemFormElName']
    • The current value of the field in $this->data['parameterArray']['itemFormElValue']

    In order for the field to work, it is vital, that the corresponding HTML input field has a unique id attribute, fills the attributes name and data-formengine-input-name with the correct name, as provided in the itemFormElName.

The field would then look like this in the backend:

New fields for fe\_users table

New fields for fe_users table

This example is also described in TYPO3 Explained, Extending TCA example.

Properties

renderType

renderType

renderType
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['renderType']
Scope
Display

The default renderType simply displays a dummy entry, indicating that a custom renderType should be added. Additional render types can be defined based on the requirements of the user type field. These render types determine how the field is displayed and interacted with in the TYPO3 backend, allowing for specialized rendering and user interaction. Custom render types provide a tailored experience for editing records via the FormEngine.

Uuid

The main purpose of the TCA type uuid is to simplify the TCA configuration when working with fields containing a UUID.

The according database field is generated automatically.

Table of contents

Example

An example configuration looks like the following:

<?php

$uuidField = [
    'label' => 'My record identifier',
    'config' => [
        'type' => 'uuid',
        'version' => 6,
    ],
];
Copied!

Properties of the TCA column type uuid

Name Type Scope
boolean Display
boolean Display / Proc.
integer Display
integer Display

enableCopyToClipboard

enableCopyToClipboard
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

In case enableCopyToClipboard is set to true, which is the default, a button is rendered next to the input field, which allows to copy the UUID to the clipboard of the operating system.

This column configuration can be overwritten by page TSconfig.

fieldInformation

fieldInformation

For details see fieldInformation.

required

required
Type
boolean
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display / Proc.
Default
false

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size

size
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

Abstract value for the width of the <input> field. To set the field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

This column configuration can be overwritten by page TSconfig.

version

version
Type
integer
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']
Scope
Display

The version option defines the UUID version to be used. Allowed values are 4, 6 or 7. The default is 4. For more information about the different versions, have a look at the corresponding Symfony documentation.

Table properties (ctrl)

The ctrl section contains properties for a database table in general.

These properties are basically divided into two main categories:

  • Properties which affect how a table is displayed and handled in the backend. This includes which icon is shown and which name is given for a record. It defines which column contains the title value, which column contains the type value etc.
  • Properties which determine how entries in the backend interface are processed by the system (TCE). This includes the publishing control, the "deleted" flag, whether a table can only be edited by admin-users, whether a table may only exist in the tree root etc.

Example: Common table control configuration

For advanced examples see Examples demonstrating the ctrl section of TCA.

A common example of the control section
EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_common.php
[
    'ctrl' => [
        'title' => 'Form engine - Common table control',
        'label' => 'title',
        'descriptionColumn' => 'description',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'default_sortby' => 'title',
        'versioningWS' => true,
        'rootLevel' => -1,
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'searchFields' => 'title,description',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

Properties of the TCA ctrl section

Name Type Scope
boolean Proc. / Display
array Display
string (list of field names) Proc.
string (field name) Proc.
string Display
string (field name) Proc. / Display
string (field name) Display
string (field name) Proc. / Display
array Proc. / Display
array (variable, depends on extension)
string Display
array Display
string Special
boolean Proc.
boolean Display
string Display
boolean Used by import/export
string (field name) Display
String (comma-separated list of field names) Display
boolean Display
string Display
array Display
string (field name of type language) Proc. / Display
string (field name) Proc.
string or LLL reference Proc.
string Display
boolean Proc. / Display
[0, 1, -1] Proc. / Display
string Search
array Display
string (field name) Proc. / Display
string or LLL reference Display
string (field name) Proc. / Display
string (field name) Proc. / Display
string (field name) Proc. / Display
string (field name) Proc.
string (field name) Display / Proc.
array Display
string (field name) Display
string (list of field names) Proc.
boolean Proc.
boolean Special

adminOnly

adminOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Records can be changed only by "admin"-users (having the "admin" flag set).

Example: Table my_table is only editable by admin users:
EXT:my_sitepackage/Configuration/TCA/my_table.php
'ctrl' => [
    'adminOnly' => 1,
    ...
],
Copied!

container

container
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display
Examples
Extended container examples

Array to configure additional items in render containers of FormEngine, see section Node expansion.

Next to single elements, some render container allow to be "enriched" with additional information via the "node expansion" API. Currently, the OuterWrapContainer implements fieldWizard and fieldInformation. InlineControlContainer implements fieldWizard and comes with the default wizard localizationStateSelector. Custom containers may implement expansion nodes, too, and if implemented correctly will automatically have their configuration merged with the definition provided in this TCA array.

The basic array looks like:

'ctrl' => [
    'container' => [
        '<containerRenderType>' => [
            'fieldWizard' => [
                '<aName>' => [
                    'renderType' => '<aRenderType>',
                    'before' => ['<anotherName>'],
                    'after' => ['<yetAnotherName>'],
                    'disabled' => false,
                    'options' => [],
                ],
            ],
        ],
    ],
],
Copied!
<containerRenderType>

should be a defined container render type. You can find more about the outerWrapContainer and inlineControlContainer in the FormEngine documentation section on rendering. Valid types are for example:

  • outerWrapContainer type which corresponds to the OuterWrapContainer (class).
  • inlineControlContainer type which corresponds to the InlineControlContainer class
  • inline type which corresponds to the InlineControlContainer class.
renderType
refers to a registered node name from NodeFactory
before, after
can be set to sort single wizards relative to each other.
disabled
can be used to disable built in default wizards.
options
Some wizards may support additional "options".

Note, next to "fieldWizard", some containers may also implement "fieldInformation", which can be manipulated the same way.

See also Extended container examples.

copyAfterDuplFields

copyAfterDuplFields
Type
string (list of field names)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

The fields in this list will automatically have the value of the same field from the "previous" record transferred when they are copied to the position after another record from same table.

Example from tt_content table:

crdate

crdate
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

Field name, which is automatically set to the current timestamp when the record is created. Is never modified again.

By convention the name crdate is used for that field.

Example

The following fields are set by the DataHandler automatically on creating or updating records, if they are configured in the ctrl section of the TCA:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'origUid' => 't3_origuid',
        // ...
    ],
];
Copied!

default_sortby

default_sortby
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

If a field name for sortby is defined, then this is ignored.

Otherwise this is used as the 'ORDER BY' statement to sort the records in the table when listed in the TYPO3 backend. It is possible to have multiple field names in here, and each can have an ASC or DESC keyword. Note that the value should not be prefixed with 'ORDER BY' in itself.

Example: Sort by title
'ctrl' => [
    'default_sortby' => 'title',
    ...
],
Copied!
Example: by title and then by creation date
'ctrl' => [
    'default_sortby' => 'title ASC, crdate DESC',
    ...
],
Copied!

delete

delete
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Field name, which indicates if a record is considered deleted or not.

If this "soft delete" feature is used, then records are not really deleted, but just marked as 'deleted' by setting the value of the field name to "1". In turn, the whole system must strictly respect the record as deleted. This means that any SQL query must exclude records where this field is true.

This is a very common feature. Most tables use it throughout the TYPO3 Core. The core extension "recycler" can be used to "revive" those deleted records again.

Example: Enable soft delete for the following table
<?php

return [
    'ctrl' => [
        'delete' => 'deleted',
        // ...
    ],
];
Copied!

descriptionColumn

descriptionColumn
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Changed in version 13.3

Field name where description of a record is stored in. This description is only displayed in the backend to guide editors and admins and should never be shown in the frontend. If filled, the content of this column is displayed in the Web > Page and Web > List module, and shown above the field list if editing a record. It is meant as a note field to give editors important additional information on single records. The TYPO3 Core sets this property for a series of main tables like be_users, be_groups and tt_content.

Example: Create a table that has a description column
Record information shown editing an example record
EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_common.php
[
    'ctrl' => [
        'title' => 'Form engine - Common table control',
        'label' => 'title',
        'descriptionColumn' => 'description',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'default_sortby' => 'title',
        'versioningWS' => true,
        'rootLevel' => -1,
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'searchFields' => 'title,description',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

editlock

editlock
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

Field name, which – if set – will prevent all editing of the record for non-admin users.

The field should be configured as a checkbox type. Non-admins could be allowed to edit the checkbox but if they set it, they will effectively lock the record so they cannot edit it again – and they need an Admin-user to remove the lock.

Note that this flag is cleared when a new copy or version of the record is created.

This feature is used on the pages table, where it also prevents editing of records on that page (except other pages)! Also, no new records (including pages) can be created on the page.

Example: A table with editlock

If the checkbox is set, the affected record can only be edited by admins.

<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'editlock' => 'editlock',
        ],
        // ...
    ],
    'palettes' => [
        'access' => [
            'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access',
            'showitem' => '
                editlock
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;access,
            ',
        ],
    ],
];
Copied!

enablecolumns

enablecolumns
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

The column definitions for these settings are auto-created.

Specifies which publishing control features are automatically implemented for the table.

This includes that records can be "disabled" or "hidden", have a starting and/or ending time and be access controlled so only a certain front end user group can access them. This property is used by the RestrictionBuilder to create SQL fragments.

These are the keys in the array you can use. Each of the values must be a field name in the table which should be used for the feature:

disabled
Defines which field serves as hidden/disabled flag.
starttime
Defines which field contains the starting time.
endtime
Defines which field contains the ending time.
fe_group
Defines which field is used for access control via a selection of FE user groups.
Record information shown editing an example record

See also the delete and features which are related, but are active for both frontend and backend.

EXT

EXT
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
(variable, depends on extension)

User-defined content for extensions. You can use this as you like.

Let's say that you have an extension with the key "myext", then it is ok to define properties for:

['ctrl']['EXT']['myext'] = ... (whatever you define)
Copied!

Note this is just a convention. You can use some other syntax but with the risk that it conflicts with some other extension or future changes in the TYPO3 Core.

formattedLabel_userFunc

formattedLabel_userFunc
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Similar to label_userFunc but allows to return formatted HTML for the label and is used only for the labels of inline (IRRE) records. The referenced user function may receive optional arguments using the formattedLabel_userFunc_options property.

formattedLabel_userFunc_options

formattedLabel_userFunc_options
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Options for formattedLabel_userFunc. The array of options is passed to the user function in the parameters array with key "options".

groupName

groupName
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Special

This option can be used to group records in the new record wizard. If you define a new table and set its "groupName" to the key of another extension, the table will appear in the list of records from that other extension in the new record wizard.

We really appreciate you setting the ctrl property title to a localized value (LLL:EXT:), otherwise it may happen that TYPO3 cannot extract the correct extension key from your table name, resulting in wrong icons in list of new record wizard. This only happens if your extension key contains underscores _, but the second part of your table name does not. For example: If your extension key is my_extension the table names will normally start with tx_myextension. Since myextension does not match the real extension key my_extension, the icon of your extension cannot be retrieved from your extension. Instead of a localized title, you can also set groupName to your real extension key: my_extension.

hideAtCopy

hideAtCopy
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

If set, and the "disabled" field from enablecolumns is specified, then records will be disabled/hidden when they are copied.

hideTable

hideTable
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Hide this table in record listings, especially the list module.

iconfile

iconfile
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Pointing to the icon file to use for the table. Icons should be square SVGs. In case you cannot supply a SVG you can still use a PNG file of 64x64 pixels in dimension.

Example usage from the "examples" extension
'ctrl' => [
    'iconfile' => 'EXT:examples/Resources/Public/Images/Haiku.svg',
    ...
],
Copied!

is_static

is_static
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Used by import/export

This marks a table to be "static".

A "static table" means that it should not be updated for individual databases because it is meant to be centrally updated and distributed. For instance static tables could contain country-codes used in many systems.

The foremost property of a static table is that the uid's used are the SAME across systems. Import/Export of records expect static records to be common for two systems.

label

label
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Required!

Points to the field name of the table which should be used as the "title" when the record is displayed in the system.

A simple example
A minimal example of the control section
EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_minimal.php
[
    'ctrl' => [
        'title' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitle',
        'label' => 'title',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
    'columns' => [
        'title' => [
            'label' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitleField',
            'config' => [
                'type' => 'input',
            ],
        ],
    ],
    'types' => [
        [
            'showitem' => 'title',
        ],
    ],
]
Copied!

label_alt

label_alt
Type
String (comma-separated list of field names)
Scope
Display

Comma-separated list of field names, which are holding alternative values to the value from the field pointed to by "label" (see above) if that value is empty. May not be used consistently in the system, but should apply in most cases.

Example for table tt_content
'ctrl' => [
    'label' => 'header',
    'label_alt' => 'subheader,bodytext',
],
Copied!

label_alt_force

label_alt_force
Type
boolean
Scope
Display

If set, then the label field and the label_alt fields are shown in the title separated by comma.

label_userFunc

label_userFunc
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Function or method reference. This can be used whenever the label or label_alt options don't offer enough flexibility, e.g. when you want to look up another table to create your label. The result of this function overrules the label, label_alt and label_alt_force settings.

When calling a method from a class, enter [classname]->[methodname]. The passed argument is an array which contains the following information about the record for which to get the title:

$params['table'] = $table;
$params['row'] = $row;
Copied!

The resulting title must be written to $params['title'], which is passed by reference.

Example

Let's look at what is done for the "haiku" table of the "examples" extension. The call to the user function appears in the EXT:examples/Configuration/TCA/tx_examples_haiku.php file:

'ctrl' => [
    'label' => 'title',
    'label_userFunc' => \Documentation\Examples\Userfuncs\Tca::class . '->haikuTitle',
],
Copied!

Class Documentation\Examples\Userfuncs\Tca contains the code itself:

public function haikuTitle(&$parameters)
{
    $record = BackendUtility::getRecord($parameters['table'], $parameters['row']['uid']);
    $newTitle = $record['title'];
    $newTitle .= ' (' . substr(strip_tags($record['poem']), 0, 10) . '...)';
    $parameters['title'] = $newTitle;
}
Copied!

label_userFunc_options

label_userFunc_options
Type
array
Scope
Display

Options for label_userFunc. The array of options is passed to the user function in the parameters array with key "options".

languageField

languageField
Type
string (field name of type language)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

This property contains the column name of the column which contains the identifier language of the record. The column definition is auto-created. If it is overridden it must still be of type Language fields.

The column is called sys_language_uid by convention.

Backend users can be limited to have edit access for only certain of these languages and if this option is set, edit access for languages will be enforced for this table.

Also see the Frontend Localization Guide for a discussion about the effects of this property (and other TCA properties) on the localization process.

Migration: Remove language column definitions from TCA

On dropping TYPO3 v12.4 support extensions authors can drop the column definitions of the language fields. They need to keep the Grouping fields (palettes) and Fields to be displayed (types) definitions, however:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

 return [
     'ctrl' => [
         'transOrigPointerField' => 'l10n_parent',
         'transOrigDiffSourceField' => 'l10n_diffsource',
         'languageField' => 'sys_language_uid',
         'translationSource' => 'l10n_source',
         // ...
     ],
-    'columns' => [
-        'sys_language_uid' => [
-            'exclude' => true,
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
-            'config' => [
-                'type' => 'language',
-            ],
-        ],
-        'l10n_parent' => [
-            'displayCond' => 'FIELD:sys_language_uid:>:0',
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
-            'config' => [
-                'type' => 'select',
-                'renderType' => 'selectSingle',
-                'items' => [
-                    [
-                        'label' => '',
-                        'value' => 0,
-                    ],
-                ],
-                'foreign_table' => 'tx_myextension_domain_model_something',
-                'foreign_table_where' =>
-                    'AND {#tx_myextension_domain_model_something}.{#pid}=###CURRENT_PID###'
-                    . ' AND {#tx_myextension_domain_model_something}.{#sys_language_uid} IN (-1,0)',
-                'default' => 0,
-            ],
-        ],
-        'l10n_source' => [
-            'config' => [
-                'type' => 'passthrough',
-            ],
-        ],
-        'l10n_diffsource' => [
-            'config' => [
-                'type' => 'passthrough',
-                'default' => '',
-            ],
-        ],
-        // ...
-    ],
     'palettes' => [
         'language' => [
             'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
     ],
     'types' => [
         0 => [
             'showitem' => '
                 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                     [...],
                 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                     --palette--;;language,
             ',
         ],
     ],
 ];
Copied!
Example: A table with localization support
A typical sys_language_uid field
EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'palettes' => [
        'language' => [
            'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
            ',
        ],
    ],
];
Copied!

origUid

origUid
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

Field name, which will contain the UID of the original record in case a record is created as a copy or new version of another record.

Is used when new versions are created from elements and enables the backend to display a visual comparison between a new version and its original.

By convention the name t3_origuid is used for that field.

Example

The following fields are set by the DataHandler automatically on creating or updating records, if they are configured in the ctrl section of the TCA:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'origUid' => 't3_origuid',
        // ...
    ],
];
Copied!

prependAtCopy

prependAtCopy
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

This string will be appended (not prepended, contrary to the name of this option) to the title of a record copy when it is inserted on the same PID as the original record to distinguish them.

Usually the value is something like (copy %s) which signifies that it was a copy that was just inserted (The token %s will be replaced by the copy number).

Note it is possible to disable this feature on a page and user or group level using the Page TSconfig option disablePrependAtCopy.

previewRenderer

previewRenderer
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Configures a backend preview for a content element.

Have also a look at Configure custom backend preview for content element for more details.

Use property previewRenderer of section types to configure the preview for a certain type only.

Example: Use for any record in a table

This specifies the preview renderer to be used for any record in tx_myextension_domain_model_mytable:

$GLOBALS['TCA']['tx_myextension_domain_model_mytable']['ctrl']['previewRenderer']
    = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Copied!

readOnly

readOnly
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Records from this table may not be edited in the TYPO3 backend. Such tables are usually called "static". If set, this property is often combined with a ext_tables_static+adt.sql file to automatically populate the table with rows.

rootLevel

rootLevel
Type
[0, 1, -1]
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Determines where a record may exist in the page tree. There are three options depending on the value:

  • 0 (false): Default. Can only exist in the page tree. Records from this table must belong to a page (i.e. have a positive "pid" field value). Thus records cannot be created in the root of the page tree (where "admin" users are the only ones allowed to create records anyways). This is the default behavior.
  • 1 (true): Can only exist in the root. Records must have a "pid"-field value equal to zero. The consequence is that only admin can edit this record.
  • -1: Can exist in both page tree and root. Records can belong either to a page (positive "pid" field value) or exist in the root of the page tree (where the "pid" field value will be 0 (zero)). Note: the -1 value will still select foreign_table records for selector boxes only from root (pid=0)

searchFields

searchFields
Type
string
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Search

Comma-separated list of fields from the table that will be included when searching for records in the TYPO3 backend. No record from a table will ever be found if that table does not have searchFields defined. Only fields of the following TCA types are searchable:

Adding fields of different types to searchFields has no effect.

There are more fine grained controls per column, see the documentation of the "search" key of any type in Field types (config > type).

Example from "tt_content" table
'ctrl' => [
    'searchFields' => 'header,header_link,subheader,bodytext,pi_flexform',
    ...
],
Copied!

security

security
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Array of sub-properties. This is used, for example, in the Core for the sys_file table:

EXT:core/Configuration/TCA/sys_file.php
return [
    'ctrl' => [
        // ...
        'security' => [
            'ignoreWebMountRestriction' => true,
            'ignoreRootLevelRestriction' => true,
        ],
        // ...
    ],
];
Copied!

And ignorePageTypeRestriction is used for the sys_note table:

EXT:sys_note/Configuration/TCA/sys_note.php
return [
    'ctrl' => [
        // ...
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
        // ...
    ],
];
Copied!

You can also use it in an override file:

EXT:my_extension/Configuration/TCA/Overrides/my_table.php
$GLOBALS['TCA']['my_table']['ctrl']['security']['ignoreWebMountRestriction'] = true;
$GLOBALS['TCA']['my_table']['ctrl']['security']['ignoreRootLevelRestriction'] = true;
$GLOBALS['TCA']['my_table']['ctrl']['security']['ignorePageTypeRestriction'] = true;
Copied!
ignoreWebMountRestriction
Allows users to access records that are not in their defined web-mount, thus bypassing this restriction.
ignoreRootLevelRestriction
Allows non-admin users to access records that are on the root-level (page ID 0), thus bypassing this usual restriction.
ignorePageTypeRestriction
Allows to use a TCA table on any kind of page doktype unless a doktype has a restriction set in the PageDoktypeRegistry API class.

selicon_field

selicon_field
Path

$GLOBALS['TCA'][$table]['ctrl']

type

string (field name)

Scope

Display

Field name, which contains the thumbnail image used to represent the record visually whenever it is shown in FormEngine as a foreign reference selectable from a selector box.

This field must be a File field where icon files are selected. Since only the first icon file will be used, the option should be used to allow only selecting a single icon file.

You should consider this a feature where you can attach an "icon" to a record which is typically selected as a reference in other records, for example a "category". In such a case this field points out the icon image which will then be shown. This feature can thus enrich the visual experience of selecting the relation in other forms.

Example: Select foreign records from a drop-down using selicon

The table tx_styleguide_elements_select_single_12_foreign is defined as follows:

[
   'ctrl' => [
      'title' => 'Form engine elements - select foreign single_12',
      'label' => 'fal_1',
      'selicon_field' => 'fal_1',
      // ...
   ],

   'columns' => [
      // ...
      'fal_1' => [
         'label' => 'fal_1 selicon_field',
         'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
            'fal_1',
            [
               'maxitems' => 1,
            ],
            $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']
         ),
      ],
   ],
   // ...

];
Copied!

It can be used in another table as a foreign relation, for example in a field with render type singleSelect:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php
[
    'columns' => [
        'select_single_12' => [
            'label' => 'select_single_12 foreign_table selicon_field',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_elements_select_single_12_foreign',
                'fieldWizard' => [
                    'selectIcons' => [
                        'disabled' => false,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

You can find this example in the extension styleguide.

sortby

sortby
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Field name, which is used to manage the order of the records when displayed.

The field contains an integer value which positions it at the correct position between other records from the same table on the current page. It should not be made editable by the user since the DataHandler will manage the content automatically.

This feature is used by e.g. the "pages" table and "tt_content" table (Content Elements) in order to output the pages or the content elements in the order expected by the editors. Extensions are expected to respect this field.

Typically the field name sorting is dedicated to this feature.

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'sortby' => 'sorting',
    ],
];
Copied!

title

title
Type
string or LLL reference
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Contains the system name of the table. Is used for display in the backend.

For instance the "tt_content" table is of course named "tt_content" technically. However in the backend display it will be shown as "Page Content" when the backend language is English. When another language is chosen, like Danish, then the label "Sideindhold" is shown instead. This value is managed by the "title" value.

You can insert plain text values, but the preferred way is to enter a reference to a localized string. Refer to the Localization section for more details.

Example for table sys_template
'ctrl' => [
    'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:sys_template',
],
Copied!

In the above example the LLL: prefix tells the system to look up a label from a localized file. The next prefix code:EXT:frontend will look for the data in the extension with the key "frontend". In that extension the file locallang_tca.xlf contains a XML structure inside of which one label tag has an index attribute named "sys_template". This tag contains the value to display in the default language. Other languages are provided by the language packs.

transOrigDiffSourceField

transOrigDiffSourceField
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

Column name, by convention l10n_diffsource, which will be updated with the value of the original language record whenever the translation record is updated. This information is later used to compare the current values of the default record with those stored in this field. If they differ, there will be a display in the form of the difference visually. This is a big help for translators so they can quickly grasp the changes that happened to the default language text.

The column in the database is auto created. If you ever override it, it should be at least a large text field (clob/blob). If you do not define the field in the file ext_tables.sql it is automatically created with the correct type.

The column definition is auto-created. If it is overridden it must still be of type Pass through / virtual field.

Example: Display changes in from the original language
Header field showing values from two other languages

Header field showing values from two other languages

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'palettes' => [
        'language' => [
            'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
            ',
        ],
    ],
];
Copied!

transOrigPointerField

transOrigPointerField
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

Name of the column, by convention l10n_parent, used by translations to point back to the original record, the record in the default language of which they are a translation.

If this value is found being set together with the languageField then the FormEngine will show the default translation value under the fields in the main form. This is very neat if translators are to see what they are translating.

The column definition is auto-created. If it is overridden it must still be of type Pass through / virtual field.

Example: Define a translation origin
EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'palettes' => [
        'language' => [
            'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
            ',
        ],
    ],
];
Copied!

translationSource

translationSource
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc. / Display

Changed in version 13.3

Name of the field, by convention l10n_source is used by translations to point back to the original record (i.e. the record in any language from which they are a translated).

This property is similar to transOrigPointerField. Both fields only contain valid record uids (and not 0), if the record is a translation (connected mode), and not a copy (free mode). In connected mode, while transOrigPointerField always contains the uid of the default language record, this field contains the uid of the record the translation was created from.

For example, if a tt_content record in default language English with uid 13 exists, this record is translated to French with uid 17, and the Danish translation is later created based on the French translation, then the Danish translation has uid 13 set as l10n_parent and 17 as l10n_source.

The column in the database is auto created. If you ever override it, it should be at least a large text field (clob/blob). If you do not define the field in the file ext_tables.sql it is automatically created with the correct type.

Example: Keep track of the translation origin in connected mode translations
EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'palettes' => [
        'language' => [
            'showitem' => '
                sys_language_uid,l10n_parent,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
            ',
        ],
    ],
];
Copied!

tstamp

tstamp
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

Field name, which is automatically updated to the current timestamp (UNIX-time in seconds) each time the record is updated/saved in the system.

By convention the name tstamp is used for that field.

Examples

The following fields are set by the DataHandler automatically on creating or updating records, if they are configured in the ctrl section of the TCA:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'origUid' => 't3_origuid',
        // ...
    ],
];
Copied!

type

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:

The type selector of a content elements

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_field:foreign_type_field. For example the sys_file_metadata table takes its type from the sys_file table.

Examples the type stored in a field --------------------------

The table tx_styleguide_type 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:

EXT:styleguide/Configuration/TCA/tx_styleguide_type.php
[
    'ctrl' => [
        'title' => 'Form engine - type',
        'label' => 'input_1',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'versioningWS' => true,
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        'type' => 'record_type',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

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:

EXT:styleguide/Configuration/TCA/tx_styleguide_type.php
[
    'types' => [
        0 => [
            'showitem' => 'record_type, input_1, text_1',
        ],
        'withChangedFields' => [
            'showitem' => 'record_type, input_1, color_1, text_1',
        ],
        'withColumnsOverrides' => [
            'showitem' => 'record_type, input_1, color_1, text_1',
            'columnsOverrides' => [
                'color_1' => [
                    'label' => 'color_1, readOnly, size=10',
                    'config' => [
                        'readOnly' => true,
                        'size' => 10,
                    ],
                ],
                'text_1' => [
                    'config' => [
                        'renderType' => 'codeEditor',
                        'format' => 'html',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

See the section about types for more details.

Type in relation to a foreign table's field

The type of the record is fetched from the record specified in field `foreign_table`

The following table tx_styleguide_type_foreign stores its relation to the table tx_styleguide_type in the field foreign_table.

The type of the table tx_styleguide_type_foreign comes from the content of the field tx_styleguide_type:record_type of the related field.

The type is therefore defined via type = 'foreign_table:record_type'.

The control section of the table tx_styleguide_type_foreign looks like this:

EXT:styleguide/Configuration/TCA/tx_styleguide_typeforeign.php
[
    'ctrl' => [
        'title' => 'Form engine - type from foreign table',
        'label' => 'input_1',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'versioningWS' => true,
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        'type' => 'foreign_table:record_type',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

The field foreign_table in the same table is a normal singleSelect field. It can be any kind of 1 - 1 or 1 - n relation.

EXT:styleguide/Configuration/TCA/tx_styleguide_typeforeign.php
[
    'columns' => [
        'foreign_table' => [
            'label' => 'type from foreign table',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_styleguide_type',
                'minitems' => 1,
                'maxitems' => 1,
                'size' => 1,
            ],
        ],
    ],
]
Copied!

typeicon_classes

typeicon_classes
Type
array
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Array of icon identifiers to use for the records. The keys must correspond to the values found in the column referenced in the typeicon_column property. The values correspond to icons registered in the Icon API. With the key default, a default icon is defined, which is used when no matching key is found. The default icon is also used in the "Create new record" dialog from the List module. For using and configuring typeicon_classes for custom page types, please see Create a new Page Type.

Example from the tt_content table:
'typeicon_classes' => [
    'default' => 'mimetypes-x-content-text',
    'header' => 'mimetypes-x-content-header',
    ...
],
Copied!

typeicon_column

typeicon_column
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Display

Field name, whose value decides alternative icons for the table records.

The values in the field referenced by this property must match entries in the array defined in typeicon_classes properties. If no match is found, the default icon is used. See example in the related typeicon_classes property.

If used, the value of this property is often set to the same field name as type.

useColumnsForDefaultValues

useColumnsForDefaultValues
Type
string (list of field names)
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

When a new record is created, this defines the fields from the 'previous' record that should be used as default values.

What is considered the 'previous' record depends on how the record is created. For example, if TSconfig options.saveDocNew is enabled, you can create a new record from an existing one using the "New" button.

This may still get overridden by the default values for the record. When assigning values to a new record the following are used (applied in that order, e.g. Page TSconfig will override User TSconfig):

  1. User TSconfig
  2. Page TSconfig
  3. From 'previous' record
  4. Default values
  5. From 'inline' relations

See \TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew->DatabaseRowInitializeNew()

Example from "pages" table
'ctrl' => [
    'useColumnsForDefaultValues' => 'doktype,fe_group,hidden',
    // ...
],
Copied!

versioningWS

versioningWS
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Proc.

If set, versioning is enabled for this table.

Versioning in TYPO3 is based on this scheme:

[Online version, pid>=0] 1- * [Offline versions, pid==1]
Copied!

Offline versions are identified by having a pid value = -1 and they refer to their online version by the field t3ver_oid. Offline versions of the "Page" and "Branch" types (contrary to "Element" type) can have child records which points to the uid of their offline "root" version with their pid fields (as usual). These children records are typically copies of child elements of the online version of the offline root version, but are not considered "versions" of them in a technical sense, hence they don't point to them with their t3ver_oid field (and shouldn't).

In the backend "Offline" is labeled "Draft" while "Online" is labeled "Live".

In order for versioning to work on a table there are certain requirements; Tables supporting versioning must have these fields:

t3ver_oid
For offline versions; pointing back to online version uid. For online: 0 (zero)
t3ver_wsid
For offline versions: Workspace ID of version. For all workspace Ids apart from 0 (zero) there can be only one version of an element per ID. For online: 0 (zero) unless t3ver_state is set in which case it plays a role for previews in the backend (to no de-select placeholders for workspaces, see \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause()) and for publishing of move-to-actions (see \TYPO3\CMS\Backend\Utility\BackendUtility::getMovePlaceholder()).
t3ver_state

Contains special states of a version used when new, deleted, moved content requires versioning.

  • For an online version:

    • "1" or "2" means that it is a temporary placeholder for a new element (which is the offline version of this record)
    • If "t3ver_state" has a value >0 it should never be shown in Live workspace.
  • For an offline version:

    • "1" or "2" means that when published, the element must be deleted (placeholder for delete-action).
    • "-1" means it is just an indication that the online version has the flag set to "1" (is a placeholder for new records.). This only affects display, not processing anywhere.
t3ver_stage
Contains the ID of the stage at which the record is. Special values are "0" which still refers to "edit", "-10" refers to "ready to publish".
t3ver_count
0/offline=draft/never published, 0/online=current, 1/offline=archive, 1+=multiple online/offline occurrences (incrementation happens when versions are swapped offline.)
t3ver_tstamp
Timestamp of last swap/publish action.

Changed in version 10.0

Field t3ver_move_id is not evaluated anymore. It can be safely dropped after the upgrade wizard has been executed.

Corresponding SQL definitions:

t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
Copied!

Special `t3ver_swapmode` field for pages

When pages are versioned it is an option whether content and even the branch of the page is versioned. This is determined by the parameter treeLevels set when the page is versioned. -1 means swap only record, 0 means record and content and '> 0' means full branch. When the version is later published the swapping will happen accordingly.

versioningWS_alwaysAllowLiveEdit

versioningWS_alwaysAllowLiveEdit
Type
boolean
Path
$GLOBALS['TCA'][$table]['ctrl']
Scope
Special

If set, this table can always be edited live even in a workspace and even if "live editing" is not enabled in a custom workspace. For instance this is set by default for Backend user and group records since it is assumed that administrators like the flexibility of editing backend users without having to go to the Live workspace.

Auto-created columns from 'ctrl'

New in version 13.3

Certain ctrl settings, such as the enablecolumns and languageField settings require TCA columns definitions.

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:

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

As a result of this strategy, columns fields are not auto-created, when a ctrl capability is added in a Configuration/TCA/Overrides file, and not in a Configuration/TCA "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/TCA), 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/TCA/Overrides files.

As example, "base" pages file defines this (step 1 above):

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

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

The Core thus creates this columns definition (step 2 above):

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 to avoid having a new page online in the website before it is set up completely. A Configuration/TCA/Overrides/pages.php file does this:

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

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

How to use enablecolumns in the ctrl section of TCA

Migration

Migration: Remove enable column definitions (hidden, starttime, endtime, fe_groups) from TCA On dropping TYPO3 v12.4 support extensions authors can drop the column definitions of the enable fields. They need to keep the Grouping fields (palettes) and Fields to be displayed (types) definitions, however:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
 return [
     'ctrl' => [
         'enablecolumns' => [
             'disabled' => 'hidden',
             'starttime' => 'starttime',
             'endtime' => 'endtime',
         ],
         // ...
     ],
-    'columns' => [
-        'hidden' => [
-            'exclude' => true,
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.enabled',
-            'config' => [
-                'type' => 'check',
-                'renderType' => 'checkboxToggle',
-                'items' => [
-                    [
-                        'label' => '',
-                        'invertStateDisplay' => true,
-                    ],
-                ],
-            ],
-        ],
-        'starttime' => [
-            'exclude' => true,
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
-            'config' => [
-                'type' => 'datetime',
-                'default' => 0,
-            ],
-            'l10n_mode' => 'exclude',
-            'l10n_display' => 'defaultAsReadonly',
-        ],
-        'endtime' => [
-            'exclude' => true,
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
-            'config' => [
-                'type' => 'datetime',
-                'default' => 0,
-                'range' => [
-                    'upper' => mktime(0, 0, 0, 1, 1, 2038),
-                ],
-            ],
-            'l10n_mode' => 'exclude',
-            'l10n_display' => 'defaultAsReadonly',
-        ],
-        'fe_group' => [
-            'exclude' => true,
-            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.fe_group',
-            'config' => [
-                'type' => 'select',
-                'renderType' => 'selectMultipleSideBySide',
-                'size' => 5,
-                'maxitems' => 20,
-                'items' => [
-                    [
-                        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login',
-                        'value' => -1,
-                    ],
-                    [
-                        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login',
-                        'value' => -2,
-                    ],
-                    [
-                        'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups',
-                        'value' => '--div--',
-                    ],
-                ],
-                'exclusiveKeys' => '-1,-2',
-                'foreign_table' => 'fe_groups',
-            ],
-        ],
-        // ...
-    ],
     'palettes' => [
         'paletteHidden' => [
             'showitem' => '
                 hidden
             ',
         ],
         'paletteAccess' => [
             'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access',
             'showitem' => '
                 starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
                 endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
                 --linebreak--,
                 fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel,
             ',
         ],
     ],
     'types' => [
         0 => [
             'showitem' => '
                 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                     [...],
                 --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                     --palette--;;paletteHidden,
                     --palette--;;paletteAccess,
             ',
         ],
     ],
 ];
Copied!

Examples of column enable configurations

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        // ...
    ],
    'palettes' => [
        'paletteHidden' => [
            'showitem' => '
                hidden
            ',
        ],
        'paletteAccess' => [
            'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access',
            'showitem' => '
                starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
                endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
                --linebreak--,
                fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel,
            ',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;paletteHidden,
                    --palette--;;paletteAccess,
            ',
        ],
    ],
];
Copied!

Define all enablecolumn fields

Make table hideable

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        // ...
    ],
    'palettes' => [
        'visibility' => [
            'showitem' => 'hidden',
        ],
    ],
    'types' => [
        0 => [
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    [...],
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;visibility,
            ',
        ],
    ],
];
Copied!

Common enable fields

Record information shown editing an example record
EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_common.php
[
    'ctrl' => [
        'title' => 'Form engine - Common table control',
        'label' => 'title',
        'descriptionColumn' => 'description',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'default_sortby' => 'title',
        'versioningWS' => true,
        'rootLevel' => -1,
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'searchFields' => 'title,description',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

Enablecolumns / enablefields usage

Most ways of retrieving records in the frontend automatically respect the ctrl->enablecolumns settings:

Enablecolumns in TypoScript

Records retrieved in TypoScript via the objects RECORDS, CONTENT automatically respect the settings in section ctrl->enablecolumns.

Enablecolumns / enablefields in Extbase

In Extbase repositories the records are hidden in the frontend by default, however this behaviour can be disabled by setting $querySettings->setIgnoreEnableFields(true) in the repository.

Enablecolumns in queries

Using the QueryBuilder enable columns restrictions are automatically applied.

The same is true when select() is called on the connection.

See the Restriction builder for details.

Examples demonstrating the ctrl section of TCA

A common table has a configuration such as this:

EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_common.php
[
    'ctrl' => [
        'title' => 'Form engine - Common table control',
        'label' => 'title',
        'descriptionColumn' => 'description',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'default_sortby' => 'title',
        'versioningWS' => true,
        'rootLevel' => -1,
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'searchFields' => 'title,description',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

Minimal table configuration

A minimal example of the control section
EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_minimal.php
[
    'ctrl' => [
        'title' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitle',
        'label' => 'title',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
    'columns' => [
        'title' => [
            'label' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitleField',
            'config' => [
                'type' => 'input',
            ],
        ],
    ],
    'types' => [
        [
            'showitem' => 'title',
        ],
    ],
]
Copied!

Property label is a mandatory setting, but the above properties are a recommended minimum. The list module shows an icon and a translated title of the table, and it uses the value of field title as title for single rows. Single record administration however is limited with this setup: This table does not implement soft delete, record rows can not be sorted between each other, record localization is not possible, and much more. In the database, only columns uid, pid and title are needed in ext_tables.sql with this setup.

Core table tt_content

Table tt_content makes much more excessive use of the ['ctrl'] section:

EXT:frontend/Configuration/TCA/tt_content.php
[
    'ctrl' => [
        'label' => 'header',
        'label_alt' => 'subheader,bodytext',
        'descriptionColumn' => 'rowDescription',
        'sortby' => 'sorting',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'editlock' => 'editlock',
        'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
        'delete' => 'deleted',
        'versioningWS' => true,
        'groupName' => 'content',
        'type' => 'CType',
        'hideAtCopy' => true,
        'prependAtCopy' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.prependAtCopy',
        'copyAfterDuplFields' => 'colPos,sys_language_uid',
        'useColumnsForDefaultValues' => 'colPos,sys_language_uid,CType',
        'transOrigPointerField' => 'l18n_parent',
        'transOrigDiffSourceField' => 'l18n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        'previewRenderer' => 'TYPO3\\CMS\\Backend\\Preview\\StandardContentPreviewRenderer',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
            'fe_group' => 'fe_group',
        ],
        'typeicon_column' => 'CType',
        'typeicon_classes' => [
            'header' => 'mimetypes-x-content-header',
            'text' => 'mimetypes-x-content-text',
            'textpic' => 'mimetypes-x-content-text-picture',
            'image' => 'mimetypes-x-content-image',
            'textmedia' => 'mimetypes-x-content-text-media',
            'bullets' => 'mimetypes-x-content-list-bullets',
            'table' => 'mimetypes-x-content-table',
            'uploads' => 'mimetypes-x-content-list-files',
            'list' => 'mimetypes-x-content-plugin',
            'shortcut' => 'mimetypes-x-content-link',
            'script' => 'mimetypes-x-content-script',
            'div' => 'mimetypes-x-content-divider',
            'html' => 'mimetypes-x-content-html',
            'default' => 'mimetypes-x-content-text',
            'menu_abstract' => 'content-menu-abstract',
            'menu_categorized_content' => 'content-menu-categorized',
            'menu_categorized_pages' => 'content-menu-categorized',
            'menu_pages' => 'content-menu-pages',
            'menu_subpages' => 'content-menu-pages',
            'menu_recently_updated' => 'content-menu-recently-updated',
            'menu_related_pages' => 'content-menu-related',
            'menu_sitemap' => 'content-menu-sitemap',
            'menu_sitemap_pages' => 'content-menu-sitemap-pages',
            'menu_section' => 'content-menu-section',
            'menu_section_pages' => 'content-menu-section',
        ],
        'searchFields' => 'header,header_link,subheader,bodytext,pi_flexform',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

A few remarks:

  • When tt_content records are displayed in the backend, the "label" property indicates that you will see the content from the field named "header" shown as the title of the record. If that field is empty, the content of field subheader and if empty, of field bodytext is used as title.
  • The field called "sorting" will be used to determine the order in which tt_content records are displayed within each branch of the page tree.
  • The title for the table as shown in the backend is defined as coming from a "locallang" file.
  • The "type" field will be the one named "CType". The value of this field determines the set of fields shown in the edit forms in the backend, see the ['types'] section for details.
  • Of particular note is the "enablecolumns" property. It is quite extensive for this table since it is a frontend-related table. Thus proper access rights, publications dates, etc. must be enforced.
  • Every type of content element has its own icon and its own class, used in conjunction with the Icon API to visually represent that type in the TYPO3 backend.

Extended container examples

Disable a built-in wizard

<?php

return [
    'ctrl' => [
        // ...
        'container' => [
            'inlineControlContainer' => [
                'fieldWizard' => [
                    'localizationStateSelector' => [
                        'disabled' => true,
                    ],
                ],
            ],
        ],
    ],
    // ...
];
Copied!

This disables the default localizationStateSelector fieldWizard of inlineControlContainer.

Add your own wizard

Register an own node in a ext_localconf.php:

EXT:my_extension/ext_localconf.php
<?php

declare(strict_types=1);

use MyVendor\MyExtension\FormEngine\FieldWizard\ReferencesToThisRecordWizard;

defined('TYPO3') or die();

$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1486488059] = [
    'nodeName' => 'ReferencesToThisRecordWizard',
    'priority' => 40,
    'class' => ReferencesToThisRecordWizard::class,
];
Copied!

Register the new node as fieldWizard of tt_content table in an Configuration/TCA/Overrides/tt_content.php file:

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

declare(strict_types=1);

defined('TYPO3') or die();

$GLOBALS['TCA']['tt_content']['ctrl']['container'] = [
    'outerWrapContainer' => [
        'fieldWizard' => [
            'ReferencesToThisRecordWizard' => [
                'renderType' => 'ReferencesToThisRecordWizard',
            ],
        ],
    ],
];
Copied!

In PHP, the node has to implement an interface, but can return any additional HTML which is rendered in the "OuterWrapContainer" between the record title and the field body when editing a record:

A new field wizard in OuterWrapContainer

A new field wizard in OuterWrapContainer

Add fieldInformation to field of type inline

This example can be found in Add a custom fieldInformation.

Backend display (interface)

The interface section contains configuration for display and listing in various parts of the backend. It is optional to use.

Examples: Limit items in record list

Limit items in backend list to 30 in overview, 50 in single table view:

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

$GLOBALS['TCA']['tx_myextension_mytable'] = array_merge_recursive(
    $GLOBALS['TCA']['tx_myextension_mytable'],
    [
        'interface' => [
            'maxDBListItems' => 30,
            'maxSingleDBListItems' => 50,
        ],
    ]
);
Copied!

Properties of TCA section interface

Name Type Default
integer 20
integer 100

maxDBListItems

maxDBListItems
Type
integer
Path
$GLOBALS['TCA'][$table]['interface']
Default
20

Maximum number of items shown in the List module.

maxSingleDBListItems

maxSingleDBListItems
Type
integer
Path
$GLOBALS['TCA'][$table]['interface']
Default
100

Maximum number of items shown in the List module, if this table is listed in extended mode (listing only a single table).

Grouping fields (palettes)

If editing records in the backend, all fields are usually displayed after each other in single rows. Palettes provide a way to display multiple fields next to each other if the browser window size allows this. They can be used to group multiple related fields in one combined section.

Each palette has a name and can be referenced by name from within the ['types'] section.

To modify existing palettes you can use the utility functions \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette and ExtensionManagementUtility::addFieldsToAllPalettesOfField.

Table of Contents

Examples

The TCA of the styleguide extension provides palettes with different properties.

Examples of different palettes in the extension styleguide

Palettes get defined in the section palettes of the tables TCA array.

The following TCA section specifies the different palettes.

EXT:styleguide/Configuration/TCA/tx_styleguide_palette.php
[
    'palettes' => [
        'palette_1' => [
            'label' => 'palette_1',
            'description' => 'palette description',
            'showitem' => 'palette_1_1, palette_1_3',
        ],
        'palette_2' => [
            'showitem' => 'palette_2_1',
        ],
        'palette_3' => [
            'showitem' => 'palette_3_1, palette_3_2',
        ],
        'palette_4' => [
            'showitem' => 'palette_4_1, palette_4_2, palette_4_3, --linebreak--, palette_4_4',
        ],
        'palette_5' => [
            'showitem' => 'palette_5_1, --linebreak--, palette_5_2',
        ],
        'palette_6' => [
            'showitem' => 'palette_6_1',
            'isHiddenPalette' => true,
        ],
        'palette_7' => [
            'showitem' => 'palette_7_1',
        ],
    ],
]
Copied!

The palettes then get referenced in the types section:

EXT:styleguide/Configuration/TCA/tx_styleguide_palette.php
[
    'types' => [
        [
            'showitem' => '
                --div--;palette,
                    --palette--;;palette_1,
                    --palette--;palette_2;palette_2,
                    --palette--;palette_3;palette_3,
                    --palette--;;palette_4,
                    --palette--;palette_5;palette_5,
                --div--;hidden palette,
                    --palette--;palette_6;palette_6,
                    --palette--;palette_7 (palette_6 hidden);palette_7,
            ',
        ],
    ],
]
Copied!

It is also possible to define the label of a palette directly in the palette definition. Declaring the label in an 'palettes' array can reduce boilerplate declarations if a palette is used over and over again in multiple types. If a label is defined for a palette this way, it is always displayed. Setting a specific label in the 'types' array for a palette overrides the default label that was defined within the 'palettes' array. There is no way to unset a label that is set within the 'palettes' array. It will always be displayed.

Example:

EXT:my_extension/Configuration/TCA/tx_myextension_table.php (Excerpt)
'types' => [
   'myType' => [
      'showitem' => 'aField, --palette--;;aPalette, someOtherField',
   ],
],
'palettes' => [
   'aPalette' => [
      'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang.xlf:aPaletteDescription',
      'showitem' => 'aFieldInAPalette, anotherFieldInPalette',
   ],
],
Copied!

Properties of palettes section of TCA

Name Type Scope
string
boolean
string
string (list of field names)

description

description
Type
string
Path
$GLOBALS['TCA'][$table]['palettes']

Allows to display a localized description text into the palette declaration. It will be displayed below the palette label.

This additional help text can be used to clarify some field usages directly in the UI.

Example

A palette with a description

EXT:styleguide/Configuration/TCA/tx_styleguide_palette.php
[
    'palettes' => [
        'palette_1' => [
            'label' => 'palette_1',
            'description' => 'palette description',
            'showitem' => 'palette_1_1, palette_1_3',
        ],
    ],
]
Copied!

isHiddenPalette

isHiddenPalette
Type
boolean
Path
$GLOBALS['TCA'][$table]['palettes']

If set to true, this palette will never be shown, but the fields of the palette are technically rendered as hidden elements in FormEngine.

This is sometimes useful when you want to set a field's value by JavaScript from another user-defined field. You can also use it along with the IRRE (TCA columns type inline) foreign_selector feature if you don't want the relation field to be displayed (it must be technically present and rendered though, that's why you should put it to a hidden palette in that case).

label

label
Type
string
Path
$GLOBALS['TCA'][$table]['palettes']

Allows to display a localized label text as a dedicated entry into the palette declaration, instead as a part of the types configuration. By using the explicit label entry, code duplication upon reusing existing palettes can be reduced. The label is always shown with the palette, no matter where it is referenced.

Before:

EXT:my_extension/Configuration/TCA/tx_myextension_table.php (Excerpt)
'types' => [
    'myType' => [
        'showitem' => 'aField, --palette--;LLL:EXT:myExt/Resources/Private/Language/locallang.xlf:aPaletteDescription;aPalette, someOtherField',
    ],
],
'palettes' => [
    'aPalette' => [
        'showitem' => 'aFieldInAPalette, anotherFieldInPalette',
    ],
],
Copied!

After:

EXT:my_extension/Configuration/TCA/tx_myextension_table.php (Excerpt)
'types' => [
    'myType' => [
        'showitem' => 'aField, --palette--;;aPalette, someOtherField',
    ],
],
'palettes' => [
    'aPalette' => [
        'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang.xlf:aPaletteDescription',
        'showitem' => 'aFieldInAPalette, anotherFieldInPalette',
    ],
],
Copied!

showitem

showitem
Type
string (list of field names)
Path
$GLOBALS['TCA'][$table]['palettes']
Required
true

Specifies which fields are displayed in which order in the palette, examples:

EXT:my_extension/Configuration/TCA/tx_myextension_table.php (Excerpt)
[
    'showitem' => 'aFieldName, anotherFieldName',
    'showitem' => 'aFieldName;labelOverride, anotherFieldName',
    'showitem' => 'aFieldName, anotherFieldName, --linebreak--, yetAnotherFieldName',
]
Copied!

This string is a comma separated list of field names from ['columns'] section, each field can optionally have a second, semicolon separated field to override the default label property of the field.

Instead of a field name, the special keyword --linebreak-- can be used to place groups of fields on single lines. Note this line grouping only works well if the browser window size allows multiple fields next to each other, if the width is not sufficient the fields will wrap below each other anyways.

Fields to be displayed (types)

The ['types'] section plays a crucial role in TCA to specify which fields from the ['columns'] section are displayed if editing a table row in FormEngine. At least one type has to be configured before any field will show up, the default type is 0.

Multiple types can be configured, which one is selected depends on the value of the field specified in ['ctrl']['type'] property. This approach is similar to what is often done with Single Table Inheritance in Object-orientated programming.

Changed in version 13.3

Introduction

The ['types'] system is powerful and allows differently shaped editing forms re-using fields, having own fields for specific forms and arranging fields differently on top of a single database table. The tt_content with all its different content elements is a good example on what can be done with ['types'].

The basic ['types'] structure looks like this:

'types' => [
     '0' => [
           'showitem' => 'aField, anotherField',
     ],
     'anotherType' => [
           'showitem' => 'aField, aDifferentField',
     ],
],
Copied!

So, the basic array has a key field with type names (here '0', and 'anotherType'), with a series of possible properties each, most importantly the showitem property.

Properties of types section of TCA

Name Type Scope
array (columns fields overrides) Display
list of options
bool
array
string Display
string (list of field configuration sets)
string (field name)
array
array

columnsOverrides

columnsOverrides
Type
array (columns fields overrides)
Path
$GLOBALS['TCA'][$table]['types'][$type]
Scope
Display
Examples
Examples for columnsOverrides

Changed or added ['columns'] field display definitions.

This allows to change the column definition of a field if a record of this type is edited. Currently, it only affects the display of form fields, but not the data handling.

A typical property that can be changed here is renderType.

The core uses this property to override for instance the "bodytext" field config of table "tt_content": If a record of type "text" is edited, it adds "enableRichtext = 1" to trigger an RTE to the default "bodytext" configuration, and if a type "table" is edited, it adds "renderType = textTable" and "wrap = off" to "bodytext".

The FormEngine basically merges "columnsOverrides" over the default "columns" field after the record type has been determined.

creationOptions

creationOptions
Type
list of options
Path
$GLOBALS['TCA'][$table]['types'][$type]['creationOptions']

New in version 13.0

saveAndClose

saveAndClose
Type
bool
Default
false
Path
$GLOBALS['TCA'][$table]['types'][$type]['creationOptions']['saveAndClose']
Examples
Example: Activate save and close for divider content element

New in version 13.0

If true, clicking on the new element wizard will take the user directly to the page module, rather than showing the edit form from the form engine.

Can be overridden with page TSconfig option saveAndClose.

defaultValues

defaultValues
Type
array
Path
$GLOBALS['TCA'][$table]['types'][$type]['creationOptions']['defaultValues']
Examples
Example: Activate save and close for divider content element

New in version 13.0

Default values inserted into the fields of the tt_content record on creation via the "New Content Element" wizard

Can be overridden with page TSconfig option tt_content_defValues.

previewRenderer

previewRenderer
Type
string
Path
$GLOBALS['TCA'][$table]['types'][$type]['previewRenderer']
Scope
Display
Examples
types-example-previewRenderer

Deprecated since version 13.4

To configure a preview renderer for the whole table see previewRenderer.

Configures a backend preview for a content element.

Have also a look at Configure custom backend preview for content element for more details.

Use property previewRenderer of section ctrl to configure the preview globally for the whole table.

showitem

showitem
Type
string (list of field configuration sets)
Path
$GLOBALS['TCA'][$table]['types'][$type]['showitem']
Required
true
Examples
Showitem examples

Configuration of the displayed order of fields in FormEngine and their tab alignment.

The whole string is a comma , separated list of tokens. Each token can have keywords separated by semicolon ;.

Each comma separated token is one of the following:

fieldName;fieldLabel
Name of a field to show. Optionally an alternative label (string or LLL reference) to override the default label from columns section.
--palette--;paletteLabel;paletteName

Name of a palette to show. The label (string or LLL reference) is optional. If set, it is shown above the single palette fields. The palette name is required and must reference a palette from the palette section.

--palette--;;caching // Show palette "caching" without additional label
--palette--;Caching;caching // Show palette "caching" with label "Caching"
Copied!
--div--;tabLabel
Put all fields after this token onto a new tab and name the tab as given in "tabLabel" (string or LLL reference).

subtype_value_field

subtype_value_field
Type
string (field name)
Path
$GLOBALS['TCA'][$table]['types'][$type]

Deprecated since version 13.4

Field name, which holds a value being a key in the subtypes_excludelist array. This allows to add and hide fields found in the types configuration, based on the value of another field in the row.

subtypes_addlist

subtypes_addlist
Type
array
Path
$GLOBALS['TCA'][$table]['types'][$type]

Deprecated since version 13.4

A list of fields to add when the subtype_value_field matches a key in this array.

Syntax
"[value]" => "[comma-separated list of fields which are added]"
Copied!

subtypes_excludelist

subtypes_excludelist
Type
array
Path
$GLOBALS['TCA'][$table]['types'][$type]

Deprecated since version 13.4

See property subtype_value_field.

Syntax
"[field value]" => "[comma-separated list of fields (from the main types-config) which are removed]"
Copied!

Changed in version 13.0

The properties bitmask_excludelist_bits and bitmask_excludelist_bits been removed, it is not considered anymore when rendering records in the backend record editing interface.

In case, extensions still use this setting, they should switch to casual $GLOBALS['TCA']['someTable']['ctrl']['type'] fields instead, which can be powered by columns based on string values.

Extended examples for using the types section of TCA

Showitem examples

Demonstrates property: showitem.

Extensions can also modify showitem values by utilizing ExtensionManagementUtility::addToAllTCAtypes(). See Customization Examples for details.

A form with 3 fields

'types' => [
    '0' => [
        'showitem' => 'hidden, title, poem,',
    ],
],
Copied!

The above example shows three fields of the form. Since no further '--div--' are specified, there would be only one tab. In this case FormEngine will suppress that single tab and just show all specified fields without a tabbing indicator.

A form with two tabs

'types' => [
    '0' => [
        'showitem' => '
            hidden, title, poem,
            --div--;LLL:EXT:examples/locallang_db.xml:tx_examples_haiku.images, image1, image2,
        '
    ],
],
Copied!

Put three fields on first tab "General" and the two fields "image1" and "image2" on a second tab with the localized name found in "EXT:examples/locallang_db.xml:tx_examples_haiku.images".

Rename the tab "General"

'types' => [
    '0' => [
        'showitem' => '
            --div--;LLL:EXT:examples/locallang_db.xml:tx_examples_haiku.images, hidden, title, poem,
            --div--;LLL:EXT:examples/locallang_db.xml:tx_examples_haiku.images, image1, image2,
        '
    ],
],
Copied!

Similar to the example before, but rename the "General" tab to the string specified in label "LLL:EXT:examples/locallang_db.xml:tx_examples_haiku.images".

Required type examples

Required type - minimal configuration

The type 0 is required to be defined. It has to have at least the property showitem defined. A minimal configuration can be seen here, for example:

EXT:styleguide/Configuration/TCA/tx_styleguide_ctrl_minimal.php
[
    'types' => [
        [
            'showitem' => 'title',
        ],
    ],
]
Copied!

It displays nothing but a single field.

Required type - tabs and palettes

The following configuration specifies two tabs: the first one labelled "general" with three fields "category" "subject" and "message", and the second one labelled "access" with the field "personal". Only the default type "0" is specified. Opening such a record looks like this:

A common example of the control section

Optional additional types

The power of the "types" configuration becomes clear when you want the form composition of a record to depend on a value from the record. Let's look at the tx_styleguide_type table from the styleguide extension. The ctrl section of its TCA contains a property called :php: type:

EXT:styleguide/Configuration/TCA/tx_styleguide_type.php
[
    'ctrl' => [
        'title' => 'Form engine - type',
        'label' => 'input_1',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'delete' => 'deleted',
        'sortby' => 'sorting',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
        'versioningWS' => true,
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'translationSource' => 'l10n_source',
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        'type' => 'record_type',
        'security' => [
            'ignorePageTypeRestriction' => true,
        ],
    ],
]
Copied!

This indicates that the field called record_type is to specify the type of any given record of the table. Let's look at how this field is defined in the property columns:

EXT:styleguide/Configuration/TCA/tx_styleguide_type.php
[
    'columns' => [
        'record_type' => [
            'label' => 'type',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'type 0',
                        'value' => '0',
                    ],
                    [
                        'label' => 'Type with changed fields',
                        'value' => 'withChangedFields',
                    ],
                    [
                        'label' => 'Type with columnsOverrides',
                        'value' => 'withColumnsOverrides',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

There's nothing unusual here. It's a pretty straightforward select field, with three options. Finally, in the types section, we define what fields should appear and in what order for every value of the type field:

EXT:styleguide/Configuration/TCA/tx_styleguide_type.php
[
    'types' => [
        0 => [
            'showitem' => 'record_type, input_1, text_1',
        ],
        'withChangedFields' => [
            'showitem' => 'record_type, input_1, color_1, text_1',
        ],
        'withColumnsOverrides' => [
            'showitem' => 'record_type, input_1, color_1, text_1',
            'columnsOverrides' => [
                'color_1' => [
                    'label' => 'color_1, readOnly, size=10',
                    'config' => [
                        'readOnly' => true,
                        'size' => 10,
                    ],
                ],
                'text_1' => [
                    'config' => [
                        'renderType' => 'codeEditor',
                        'format' => 'html',
                    ],
                ],
            ],
        ],
    ],
]
Copied!

The result if the following display when type 0 is chosen:

Changing to type withChangedFields reloads the form and displays the a different set of fields:

Examples for columnsOverrides in type section of TCA

Demonstrates property: columnsOverrides.

Type withOverriddenColumns shows the fields and overrides part of the configuration of the fields:

Example adding "nowrap" to a text type for type "text"

Demonstrates property: columnsOverrides.

Example adding "nowrap" to a text type for type "text":

EXT:my_extension/Configuration/TCA/tx_myextension_table.php (Excerpt)
'types' => [
    'text' => [
        'showitem' => 'hidden, myText',
        'columnsOverrides' => [
            'myText' => [
                'config' => [
                    'wrap' => 'off',
                ],
            ],
        ],
    ],
    // ...
],
Copied!

PreviewRenderer examples

Deprecated since version 13.4

Demonstrates property: previewRenderer.

This specifies the preview renderer only for records of type $type as determined by the type field of your table.

$GLOBALS['TCA']['tt_content']['types'][$type]['previewRenderer']
    = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Copied!

Example: Activate save and close for divider content element

Demonstrates property: saveAndClose.

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

$GLOBALS['TCA']['tt_content'] = array_merge_recursive(
    $GLOBALS['TCA']['tt_content'],
    [
        // ...
        'types' => [
            'div' => [
                'creationOptions' => [
                    'saveAndClose' => true,
                    'defaultValues' => [
                        'bodytext' => '<p>some text</p>',
                    ],
                ],
            ],
        ],
    ]
);
Copied!

Migration from subtypes to types

Migrate plugins with FlexForms added via subtypes_addlist

If you used plugins with the now deprecated subtypes, you probably used subtypes_addlist to display a FlexForm for configuration purposes.

Migrate by adding the field pi_flexform with the utility method ExtensionManagementUtility addToAllTCAtypes() instead. You also have to change the parameters used for method addPiFlexFormValue():

EXT:my_extension/Configuration/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'blog_example',
     'Pi1',
     'A Blog Example',
 );
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature]
-    = 'pi_flexform';

+ExtensionManagementUtility::addToAllTCAtypes(
+    'tt_content',
+    '--div--;Configuration,pi_flexform,pages,recursive,',
+    $pluginSignature,
+    'after:subheader',
+);
 ExtensionManagementUtility::addPiFlexFormValue(
-    $pluginSignature,
+    '*',
     'FILE:EXT:blog_example/Configuration/FlexForms/PluginSettings.xml',
+    $pluginSignature,
 );
Copied!

The fields pages and recursive used to be added automatically to plugins when using the now outdated subtype "list_type". Therefore they have to be added manually when doing the migration.

Migrate plugins with fields removed via subtypes_excludelist

Many extension author used the now deprecated option subtypes_excludelist to hide these automatically added fields.

The same effect can now be used by simply not adding the fields in the first place:

EXT:my_extension/Configuration/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'blog_example',
     'Pi1',
     'A Blog Example',
 );
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature]
-    = 'pages,recursive';
Copied!

If any other fields have been removed with this method you can only remove them by overriding $GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['showitem'] or via page TSconfig.

Migrate custom tables using subtypes

Replace any subtype_value_field configuration with dedicated record types. Please also consider migrating corresponding subtypes_addlist and subtypes_excludelist definitions accordingly.

EXT:my_extension/Configuration/TCA/tx_myextension_mytable.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'blog_example',
     'Pi1',
     'A Blog Example',
 );
-$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature]
-    = 'pages,recursive';
Copied!

Migration: PreviewRenderer for subtypes

When migrating a plugin with a PreviewRenderer from list_type registration to its own CType change the PreviewRenderer configuration to the record type as well:

EXT:my_extension/Configuration/Overrides/tt_content.php
 $pluginSignature = ExtensionUtility::registerPlugin(
     'blog_example',
     'Pi1',
     'A Blog Example',
 );
-$GLOBALS['TCA']['tt_content']['types']['list_type']['previewRenderer'][$pluginSignature]
-        = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
+$GLOBALS['TCA']['tt_content']['types'][$pluginSignature]['previewRenderer']
+        = \MyVendor\MyExtension\Preview\PreviewRenderer::class;
Copied!

Automatically added system fields to content types (tt_content)

Changed in version 13.3

The following tabs / palettes are added automatically to the showitem property of table tt_content:

  • The General tab with the general palette at the very beginning
  • The Language tab with the language palette after custom fields
  • The Access tab with the hidden and access palettes
  • The Notes tab with the rowDescription field
The edit form of a slider with its tabs. The above mentioned ones are underlined.

The underlined tabs are added automatically.

See Extended content element with custom fields for an example.

In case one of those palettes has been changed to no longer include the corresponding system fields, those fields are added individually depending on their definition in the Table properties (ctrl) section.

By default, all custom fields - the ones still defined in showitem - are added after the general palette and are therefore added to the General tab, unless a custom tab (for example Plugin, or Categories) is defined in between. It's also possible to start with a custom tab by defining a --div-- as the first item in the showitem. In this case, the General tab will be omitted.

All those system fields, which are added based on the ctrl section are also automatically removed from any custom palette and from the customized type's showitem definition.

If the content element defines the Extended tab, it will be inserted at the end, including all fields added to the type via API methods, without specifying a position, via \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTcaTypes(). See Extended content element with custom fields for an example.

Examples for the showitems TCA section in content elements

Basic custom content element with header and bodytext

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

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

// Add the content element to the "Type" dropdown
ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    [
        'label' => 'My extension basic text element',
        'value' => 'my_extension_basic_text',
    ],
);

// Add the predefined fields to the "General" tab
$GLOBALS['TCA']['tt_content']['types']['my_extension_basic_text']['showitem'] =
    '--palette--;;headers,bodytext,';
Copied!

The following tabs are shown, the header palette and bodytext field are shown in palette general:

Screenshot of the content element form created by the code

Screenshot of the content element form created by the code

Extended content element with custom fields

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

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

// Add the content element to the "Type" dropdown
ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    [
        'label' => 'My extension custom text element with links',
        'value' => 'my_extension_extended-text',
        'icon' => 'my-extension-content-text',
        'group' => 'default',
        'description' => 'Some descripton',
    ],
    'textmedia',
    'after',
);

// Define some custom columns
$additionalColumns = [
    'my_extension_link' => [
        'label' => 'My link',
        'config' => [
            'type' => 'link',
        ],
    ],
    'my_extension_link_text' => [
        'label' => 'My link text',
        'config' => [
            'type' => 'input',
        ],
    ],
    'my_extension_extra_text' => [
        'label' => 'My extra text',
        'config' => [
            'type' => 'input',
        ],
    ],
];
// Add the custom columns to the TCA of tt_content
ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalColumns);

// Add predefined and custom fields to the "General tab" and introduce a tab called "Extended"
$GLOBALS['TCA']['tt_content']['types']['my_extension_extended-text']['showitem'] = '
    --palette--;;headers,
    bodytext,
    --div--;My tab,
        my_extension_link,
        my_extension_link_text,
    --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,';

// This field will be added in tab "Extended"
ExtensionManagementUtility::addToAllTCAtypes(
    'tt_content',
    'my_extension_extra_text',
    'my_extension_extended-text'
);
Copied!

The following tabs are shown:

Screenshot of the content element form created by the code

Screenshot of the content element form created by the code

Additional fields that are subsequently added to the end of the table using \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTcaTypes() will appear in the tab Extended.

Migration: Remove system fields from showitems on dropping TYPO3 v12.4 support

It is sufficient to apply changes to the showitem section of content types once dropping TYPO3 v12.4 support in extensions.

In site packages or extensions only supporting TYPO3 v13.3 or above you can migrate the showitem right away:

EXT:my_extension/Configuration/TCA/Overrides/tt_content.php (diff)
 'slider' => [
     'showitem' => '
-        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
-            --palette--;;general,
             --palette--;;headers,
             slider_elements,
             bodytext;LLL:EXT:awesome_slider/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.slider_description,
         --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:appearance,
             --palette--;;frames,
             --palette--;;appearanceLinks,
-        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
-            --palette--;;language,
-        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
-            --palette--;;hidden,
-            --palette--;;access,
         --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
             categories,
-        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
-            rowDescription,
         --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
     ',
 ],
Copied!

So the tabs General, Language, Access and Notes are now added automatically together with the corresponding system fields.

Sitemap