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 render
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
render
of TCA type input
.
The TCA type color
features the following column configuration:
behaviour
:allow
Language Synchronization default
field
Control field
Information field
Wizard mode
nullable
placeholder
read
Only required
search
size
value
:Picker 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 value
allows to define default color codes via items
for a TCA type color
field.
The following column configuration can be overwritten by page TSconfig:
read
Only size
A complete migration from render
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_
error
where code adoption has to take place.
Note
The corresponding FormEngine class has been renamed from
Input
to Color
. 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
.