Deprecation: #105213 - TCA sub types

See forge#105213

Description

One of the main features of TCA are the record types. This allows to use a single table for different purposes and in different contexts. The most known examples of using record types are the "Page Types" of pages and the "Content Types" of tt_content. For every specific type of such table, it's possible to define the fields to be used and even manipulate them e.g. change their label.

A special case since ever has been the plugin registration. This for a long time has been done using the so called "sub types" feature of TCA. This is another layer below record types and allows to further customize the behaviour of a record type using another select field, defined via subtype_value_field as well as defining fields to be added - subtypes_addlist - or excluded - subtypes_excludelist - for the record type, depending on the selected sub type.

For a couple of version now, it's encouraged to register plugins just as standard content elements via the tt_content type field CType. Therefore, the special registration via the combination of the list record type and the selection of a sub type via the list_type field has already been deprecated with Deprecation: #105076 - Plugin content element and plugin sub types.

Since the "sub types" feature was mainly used for this scenario only, it has now been deprecated as well. Registration of custom types should therefore always be done by using record types. This makes configuration much cleaner and more comprehensible.

Impact

Using subtype_value_field in a TCA types configurations will lead to a deprecation log entry containing information about where adaptations need to take place.

Affected installations

All installations using the sub types feature by defining a subtype_value_field in a TCA types configuration, which is really uncommon as the feature was mainly used for plugin registration in the tt_content table only.

Migration

Replace any subtype_value_field configuration with dedicated record types. Please also consider migrating corresponding subtypes_addlist and subtypes_excludelist definitions accordingly.

Before

'ctrl' => [
    'type' => 'type',
],
'columns' => [
    'type' => [
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => [
                [
                    'label' => 'A record type',
                    'value' => 'a_record_type'
                ]
            ]
        ]
    ],
    'subtype' => [
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => [
                [
                    'label' => 'A sub type',
                    'value' => 'a_sub_type'
                ]
            ]
        ]
    ],
],
'types' => [
    'a_record_type' => [
        'showitem' => 'aField,bField',
        'subtype_value_field' => 'subtype',
        'subtypes_addlist' => [
            'a_sub_type' => 'pi_flexform'
        ],
        'subtypes_excludelist' => [
            'a_sub_type' => 'bField'
        ]
    ]
]
Copied!

After

'ctrl' => [
    'type' => 'type',
],
'columns' => [
    'type' => [
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => [
                [
                    'label' => 'A record type',
                    'value' => 'a_record_type'
                ],
                [
                    'label' => 'A sub type',
                    'value' => 'a_sub_type'
                ]
            ]
        ]
    ],
],
'types' => [
    'a_record_type' => [
        'showitem' => 'aField,bField'
    ],
    'a_sub_type' => [
        'showitem' => 'aField,pi_flexform'
    ]
]
Copied!