Category¶
New in version 11.4: The 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 CategoryRegistry
as well
as the ExtensionManagementUtility->makeCategorizable()
, which has required
creating a "TCA overrides" file.
While using the type category
, TYPO3 takes care of generating the
necessary TCA configuration.
Developers only have to define the TCA column and add category
as the
desired TCA type in the tables's TCA file (inside or outside of the Overrides folder).
$GLOBALS['TCA'][$myTable]['columns']['categories'] = [
'config' => [
'type' => 'category'
]
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
$myTable,
'categories'
);
The following options can be overridden via page TSconfig, TCE form:
size
maxitems
minitems
readOnly
treeConfig
Note
It is still possible to configure a category tree with type=select
and renderType=selectTree
when you want to override specific fields, but in most cases the
simplified category
TCA type is sufficient.