Feature: #97232 - New TCA type "datetime"
See forge#97232
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 datetime
has been introduced. It replaces the
render
of TCA type input
.
The TCA type datetime
features the following column configuration:
behaviour
:allow
Language Synchronization db
:Type date
,time
,datetime
default
disable
Age Display field
Control field
Information field
Wizard format
:datetime
(default),date
,time
,timesec
mode
nullable
placeholder
range
:lower
,upper
read
Only required
search
size
Note
The eval=integer
option is now automatically set for the element
in case no specific db
has been defined. It should therefore
be removed from the TCA configuration.
Note
The format
option defines how the display of the field value
will be in e.g. FormEngine. The storage format is defined via db
and falls back to eval=integer
.
The following column configuration can be overwritten by page TSconfig:
read
Only size
A complete migration from render
to type=datetime
looks like the following:
// Before
'a_datetime_field' => [
'label' => 'Datetime field',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'required' => true,
'size' => 20,
'max' => 1024,
'eval' => 'date,int',
'default' => 0,
],
],
// After
'a_datetime_field' => [
'label' => 'Datetime field',
'config' => [
'type' => 'datetime',
'format' => 'date',
'required' => true,
'size' => 20,
'default' => 0,
]
]
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 Datetime
. 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.
Automatic database fields
TYPO3 automatically creates database fields for TCA type datetime
columns, if they have not already been defined in an extension's
ext_
file. This also supports columns, having a
native database type (db
) defined. Fields without a native
type always define default 0
and are always signed (to allow
negative timestamps). As long as a column does not use nullable=true
,
the fields are also always defined as NOT NULL
.
Impact
It's now possible to simplify the TCA configuration by using the new
dedicated TCA type datetime
. Next to reduced TCA configuration,
the new type allows to omit the corresponding database field definition.