You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new TCA field type called category has been added to TYPO3 Core. Its
main purpose is to simplify the TCA configuration when adding a category
tree to a record. It therefore supersedes the \TYPO3\CMS\Core\Category\CategoryRegistry as well as the \TYPO3\CMS\Core\Utility\ExtensionManagementUtility->makeCategorizable(),
which required creating a "TCA overrides" file.
Both, the CategoryRegistry as well as ExtensionManagementUtility->makeCategorizable() are going to be
deprecated in the future.
While using the new type, TYPO3 takes care of generating the necessary
TCA configuration and also adds the database column automatically.
Developers only have to configure the TCA column and add it to the
desired record types.
The above example does not contain the new option relationship since
the default is manyToMany. All possible values are:
oneToOne: Stores the uid of the selected category. When using this
relationship, maxitems=1 will automatically be added to the column
configuration
oneToMany: Stores the uids of selected categories in a
comma-separated list
manyToMany (default): Uses the intermediate table sys_category_record_mm and only stores the categories count on the
local side. This is the use case, which was previously accomplished
using ExtensionManagementUtility->makeCategorizable().
This means, the new type can not only be used with relationship=manyToMany as a replacement for makeCategorizable but
can be used for other use cases too. In case a category tree is
required, only allowing one category to be selected, the necessary
configuration reduces to
All other relevant options, e.g. maxitems=1, are being set
automatically.
Besides type and relationship, following type specific options are
available:
default
exclusiveKeys: As known from renderType=selectTree
treeConfig: As known from renderType=selectTree
It's possible to use TSconfig options, such as removeItems. However,
adding static items with TSconfig is not implemented for this type. For
such special cases, please continue using TCA type select.
The Override matrix - specifying the options which can be overridden in
TSconfig - is extended for the new type. Following options can be
overridden:
size
maxitems
minitems
readOnly
treeConfig
Note
It's still possible to configure a category tree with type=select
and renderType=selectTree. This configuration will still work, but
could in most cases be simplified, using the new category TCA type.
Flexform usage
It's also possible to use the new type in flexform data structures.
However, due to some limitations in flexform, the "manyToMany"
relationship is not supported. Therefore, the default relationship -
used if none is defined -is "oneToMany". This is anyways the most common
use case for flexforms, as it's not important to look from the other
side "which flexform elements reference this category". An example of
the "oneToMany" use case is EXT:news, which allows to only display news
of specific categories in the list view.
Feature: #94622 - New TCA type "category"
https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Feature-94622-NewTCATypeCategory.html
Feature: #94622 - New TCA type "category"
See 94622
Description
A new TCA field type called
category
has been added to TYPO3 Core. Itsmain purpose is to simplify the TCA configuration when adding a category
tree to a record. It therefore supersedes the
\TYPO3\CMS\Core\Category\CategoryRegistry
as well as the\TYPO3\CMS\Core\Utility\ExtensionManagementUtility->makeCategorizable()
,which required creating a "TCA overrides" file.
Both, the
CategoryRegistry
as well asExtensionManagementUtility->makeCategorizable()
are going to bedeprecated in the future.
While using the new type, TYPO3 takes care of generating the necessary
TCA configuration and also adds the database column automatically.
Developers only have to configure the TCA column and add it to the
desired record types.
The above example does not contain the new option
relationship
sincethe default is
manyToMany
. All possible values are:oneToOne
: Stores the uid of the selected category. When using thisrelationship,
maxitems=1
will automatically be added to the columnconfiguration
oneToMany
: Stores the uids of selected categories in acomma-separated list
manyToMany
(default): Uses the intermediate tablesys_category_record_mm
and only stores the categories count on thelocal side. This is the use case, which was previously accomplished
using
ExtensionManagementUtility->makeCategorizable()
.This means, the new type can not only be used with
relationship=manyToMany
as a replacement formakeCategorizable
butcan be used for other use cases too. In case a category tree is
required, only allowing one category to be selected, the necessary
configuration reduces to
All other relevant options, e.g.
maxitems=1
, are being setautomatically.
Besides
type
andrelationship
, following type specific options areavailable:
default
exclusiveKeys
: As known fromrenderType=selectTree
treeConfig
: As known fromrenderType=selectTree
It's possible to use TSconfig options, such as
removeItems
. However,adding static items with TSconfig is not implemented for this type. For
such special cases, please continue using TCA type
select
.The Override matrix - specifying the options which can be overridden in
TSconfig - is extended for the new type. Following options can be
overridden:
size
maxitems
minitems
readOnly
treeConfig
Note
It's still possible to configure a category tree with
type=select
and
renderType=selectTree
. This configuration will still work, butcould in most cases be simplified, using the new
category
TCA type.Flexform usage
It's also possible to use the new type in flexform data structures.
However, due to some limitations in flexform, the "manyToMany"
relationship is not supported. Therefore, the default relationship -
used if none is defined -is "oneToMany". This is anyways the most common
use case for flexforms, as it's not important to look from the other
side "which flexform elements reference this category". An example of
the "oneToMany" use case is EXT:news, which allows to only display news
of specific categories in the list view.
Impact
It's now possible to simplify the TCA configuration for category fields,
using the new TCA type
category
.Backend, TCA, ext:backend
The text was updated successfully, but these errors were encountered: