Feature: #97271 - New TCA type "color"

See forge#97271

Description

Especially TCA type input has a wide range of use cases, depending on the configured renderType and the eval options. Determination of the semantic meaning is therefore usually quite hard and often leads to duplicated checks and evaluations in custom extension code.

In our effort of introducing dedicated TCA types for all those use cases, the TCA type color has been introduced. It replaces the renderType=colorpicker of TCA type input.

The TCA type color features the following column configuration:

  • behaviour: allowLanguageSynchronization

  • default

  • fieldControl

  • fieldInformation

  • fieldWizard

  • mode

  • nullable

  • placeholder

  • readOnly

  • required

  • search

  • size

  • valuePicker: items

Note

The value of TCA type color columns is automatically trimmed before being stored in the database. Therefore, the eval=trim option is no longer needed and should be removed from the TCA configuration.

Note

The valuePicker allows to define default color codes via items for a TCA type color field.

The following column configuration can be overwritten by page TSconfig:

  • readOnly

  • size

A complete migration from renderType=colorpicker to type=color looks like the following:

// Before

'a_color_field' => [
    'label' => 'Color field',
    'config' => [
        'type' => 'input',
        'renderType' => 'colorpicker',
        'required' => true,
        'size' => 20,
        'max' => 1024,
        'eval' => 'trim',
        'valuePicker' => [
            'items' => [
                ['typo3 orange', '#FF8700'],
            ],
        ],
    ],
],

// After

'a_color_field' => [
    'label' => 'Color field',
    'config' => [
        'type' => 'color',
        'required' => true,
        'size' => 20,
        'valuePicker' => [
            'items' => [
                ['typo3 orange', '#FF8700'],
            ],
        ],
    ]
]

An automatic TCA migration is performed on the fly, migrating all occurrences to the new TCA type and triggering a PHP E_USER_DEPRECATED error where code adoption has to take place.

Note

The corresponding FormEngine class has been renamed from InputColorPickerElement to ColorElement. An entry in the "ClassAliasMap" has been added for extensions calling this class directly, which is rather unlikely. The extension scanner will report any usage, which should then be migrated.

Impact

It's now possible to simplify the TCA configuration by using the new dedicated TCA type color.