Feature: #97193 - New TCA type "number"¶
See forge#97193
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 number
has been introduced. It replaces the
eval=int
and eval=double2
options of TCA type input
.
The TCA number
fields will be rendered with the html type
attribute set to number
.
The TCA type number
features the following column configuration:
autocomplete
behaviour
:allowLanguageSynchronization
default
fieldControl
fieldInformation
fieldWizard
format
:integer
,decimal
mode
nullable
placeholder
range
:lower
,upper
readOnly
required
search
size
slider
:step
,width
valuePicker
:items
,mode
The following column configuration can be overwritten by page TSconfig:
readOnly
size
The TCA type number
introduces the new configuration format
,
which can be set to decimal
or integer
, which is the default.
Note
The slider
option allows to define a visual slider element
next to the input field. The steps can be defined with the step
option. The minimum and maximum value can be configured with the
range[lower]
and range[upper]
options.
Note
The valuePicker
option allows to define default values via
items
. With mode
, one can define how the selected
value should be added (replace, prepend or append).
Note
The options range
, slider
as well as eval=double2
are no longer evaluated for TCA type input
.
Migration¶
The migration from eval='int'
to type=number
is done like following:
// Before
'int_field' => [
'label' => 'Int field',
'config' => [
'type' => 'input',
'eval' => 'int',
]
]
// After
'int_field' => [
'label' => 'Int field',
'config' => [
'type' => 'number',
]
]
The migration from eval=double2
to type=number
is done like following:
// Before
'double2_field' => [
'label' => 'double2 field',
'config' => [
'type' => 'input',
'eval' => 'double2',
]
]
// After
'double2_field' => [
'label' => 'double2 field',
'config' => [
'type' => 'number',
'format' => 'decimal'
]
]
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.
Impact¶
It's now possible to simplify the TCA configuration by using the new
dedicated TCA type number
. Setting the new format
option
to decimal
behaves like the former eval=double2
.