Record types
See also
Field types (config > type) are a different concept to record types.
A types section is mandatory in all table definitions.
The types section is an array of types $GLOBALS each
containing a showitem key which determines which fields will be displayed in
the backend form for the record. Most TCA tables will only contain one type.
However, it is possible to have many types in the same table with different fields being displayed depending on the type. Then a new database field needs to be created to save the type with the data. This field is set in $GLOBALS['TCA'][$table]['ctrl']['type'].
Defining multiple types in one table is similar to Single Table Inheritance in Object-orientated programming.
Table of Contents
Subpages
Changed in version 13.3
Creating content elements has been simplified by removing the need to define the system fields for each element again and again. This shrinks down a content element's showitem to just the element specific fields. See also Automatically added system fields to content types (tt_content).
A basic table without distinct types
A table record supporting only one type defines which fields should be displayed in the backend form for the default type.
As an example, a comment on a blog post can be stored in a table as follows:
<?php
return [
    'ctrl' => [
        'title' => 'Comment',
        // ...
    ],
    'types' => [
        '0' => [
            'showitem' => 'hidden, name, email, content, date',
        ],
    ],
    'columns' => [
        // ...
    ],
];
The types section is mandatory.
Supporting multiple record types in the same table
If a table supports multiple record types, the type of the record must be
saved in a dedicated database field, commonly named record_ or just type.
Usually a select field is used for that purpose.
The name of this field is registered in the ctrl section via property
type.
As an example, a blog post might have several types where the fields displayed in the backend differ:
<?php
return [
    'ctrl' => [
        'title' => 'LLL:blog_example.db:tx_blogexample_domain_model_post',
        'label' => 'title',
        'type' => 'record_type',
        'typeicon_classes' => [
            '0' => 'tx-blog-post',
            'link' => 'tx-blog-post-link',
            'special' => 'tx-blog-post-special',
        ],
        // ...
    ],
    'types' => [
        '0' => [
            'showitem' => 'blog, title, date, author, content, comments, ',
        ],
        'link' => [
            'showitem' => ' blog, title, date, author, link, ',
        ],
        'special' => [
            'showitem' => 'blog, title, date, author, content, tags, comments, ',
        ],
    ],
    'columns' => [
        'record_type' => [
            'label' => 'LLL:blog_example.labels:post_types',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        'label' => 'Blog Post',
                        'value' => '0',
                    ],
                    [
                        'label' => 'Link to External Blog Post',
                        'value' => 'link',
                    ],
                    [
                        'label' => 'Special Blog Post',
                        'value' => 'special',
                    ],
                ],
                'default' => '0',
            ],
        ],
        // ...
    ],
];
For each record type you can define additional creationOptions and change field display definitions via columnsOverrides.
It is also possible to define previewRenderers.
You can also define icons for each type using the property ctrl -> typeicon_classes.
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) | 
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 different field column definitions to be applied when a record of this type is edited. Currently, only the display of form fields is affected, not data handling. A typical property that can be changed is render.Type The core uses this property to override 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. Attention It is not possible to override any properties in "Proc." scope: The DataHandler does not take "columnsOverrides" into account. Only pure "Display" related properties can be overridden. This especially means that columns config 'type' must not be set to a different value. 
creationOptions
- 
                            - Type
- list of options
- Path
- $GLOBALS['TCA'][$table]['types'][$type]['creationOptions']
 New in version 13.0 The page TSconfig option newContentElement.wizardItems.[group].elements.[name] can be defined through TCA as well: saveAndClose
- 
                            - Type
- bool
- Default
- false
- Path
- $GLOBALS['TCA'][$table]['types'][$type]['creationOptions']['saveAndClose']
- Examples
- Example: Create the blog plugin at once
 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
- 
                            - Type
- array
- Path
- $GLOBALS['TCA'][$table]['types'][$type]['creationOptions']['defaultValues']
- Examples
- Example: Create the blog plugin at once
 New in version 13.0 Default values inserted into the fields of the tt_record on creation via the "New Content Element" wizardcontent Can be overridden with page TSconfig option tt_content_defValues. 
 
previewRenderer
- 
                            - Type
- string
- Path
- $GLOBALS['TCA'][$table]['types'][$type]['previewRenderer']
- Scope
- Display
- Examples
- types-- example- - preview - Renderer 
 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
- 
                            - Type
- string (list of field configuration sets)
- Path
- $GLOBALS['TCA'][$table]['types'][$type]['showitem']
- Required
- true
- Examples
- Display all fields on one page of the form
 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: - field- Name;field - Label 
- Name of a field to show. Optionally an alternative label (plain text label or label reference) to override the default label from columns section.
- --- palette--;palette - Label;palette - Name 
- 
    Name of a palette to show. The label (plain text label or label 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--;tab - Label 
- Put all fields after this token onto a new tab and name the tab as given in "tabLabel" (plain text label or label reference).
 Note It is good practice to add a comma in excess behind the very last field name as shown in the examples above. The FormEngine code will ignore this, but it helps developers to not forget about a comma when additional fields are added, which can suppress an annoying "Why is my new field not displayed?" bug hunt. Extensions can also modify showitemvalues by utilizingExtension. See Customization Examples for details.Management Utility:: add To All TCAtypes () 
Changed in version 13.0
The properties bitmask_ and bitmask_
have been removed, it is not considered anymore when rendering
records in the backend record editing interface.
Extensions still using this setting should switch to casual
        $GLOBALS fields instead, which
can be powered by columns based on string values.
Extended examples for using the types section of TCA 
            Display all fields on one page of the form
The table containing the blog comments does not contain many fields. So they can all be displayed on one page of the backend form without using tabs:
Group fields using tabs and use palettes
If a table has a larger number of fields, grouping them into tabs and palettes can improves the backend user experience. Palettes have the additional value that they can be reused across different record types.
<?php
return [
    'types' => [
        '0' => [
            'showitem' => '
            record_type, blog, title, date, author, content,
            --div--;core.form.tabs:access,
                hidden,
                --palette--;;paletteStartStop,
                fe_group,
            --div--;core.form.tabs:language,
                 --palette--;;paletteLanguage,
            ',
        ],
    ],
    'palettes' => [
        'paletteStartStop' => [
            'showitem' => 'starttime, endtime',
        ],
        'paletteLanguage' => [
            'showitem' => 'sys_language_uid, l10n_parent',
        ],
    ],
];
The syntax for tabs is:
--
Where label can be plain text label or label reference (preferred).
The syntax to insert a palette is:
--
The label can be omitted.
See also
Examples for columnsOverrides in type section of TCA
Demonstrates property: columnsOverrides.
For example the special blog post type might require the author to be set and use a different render type and description for the content:
<?php
return [
    'ctrl' => [
        'title' => 'LLL:blog_example.db:tx_blogexample_domain_model_post',
        // ...
    ],
    'types' => [
        'special' => [
            'columnsOverrides' => [
                'author' => [
                    'config' => [
                        'required' => true,
                    ],
                ],
                'content' => [
                    'description' => 'You can use Markdown syntax for the content. ',
                    'config' => [
                        'renderType' => 'codeEditor',
                    ],
                ],
            ],
            'showitem' => 'blog, title, date, author, content, tags, comments, ',
        ],
        // ...
    ],
    // ...
];
While the field type type cannot be changed in the columns the
render type render can be changed.
Override default values by type
A blog post of type link should have a different default value for the author field then other blog post types:
PreviewRenderer examples
Demonstrates property: previewRenderer.
This specifies the preview renderer only for records with the c 
        blogexample_
as determined by the field Ctype of the table tt_.
This could be used to preview the blog plugin in the page module.
$GLOBALS['TCA']['tt_content']['types']['blogexample_list']['previewRenderer']
    = \MyVendor\MyExtension\Preview\PreviewRenderer::class;Example: Create the blog plugin at once
Demonstrates property: saveAndClose.
When editors create a new blog plugin in the plugin is automatically saved and the user returned to the page module:
<?php
$GLOBALS['TCA']['tt_content']['types']['blogexample_list']['creationOptions']['saveAndClose'] = true;
Note
This property only takes effect in the table tt_.