Actions
Bug #98656
closedOverriding ['TCA']['pages']['columns']['categories']['config']['foreign_table_where'] does not work
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2022-10-19
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:
Description
In one of our extension we're overriding the TCA of the pages colums categories:
extfoobar\Configuration\TCA\Overrides\pages.php
$GLOBALS['TCA']['pages']['columns']['categories']['config']['foreign_table_where'] = " AND sys_category.pid IN (###PAGE_TSCONFIG_IDLIST###) AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC";
But this will allways be override by the core:
typo3_src-11.5.17/typo3/sysext/core/Classes/Preparations/TcaPreparation.php
protected function configureCategoryRelations(array $tca): array
{
....
// Initialize default column configuration and merge it with already defined
$fieldConfig['config']['size'] ??= 20;
// Force foreign_table_* fields for type category
$fieldConfig['config']['foreign_table'] = 'sys_category';
$fieldConfig['config']['foreign_table_where'] = ' AND {#sys_category}.{#sys_language_uid} IN (-1, 0)';
For ['size'] it will be checked if there's already a value defined, but not for ['foreign_table_where'].
Shluld it be like this?
$fieldConfig['config']['foreign_table_where'] = $fieldConfig['config']['foreign_table_where'] ?? ' AND {#sys_category}.{#sys_language_uid} IN (-1, 0)';
Or am I doing something wrong?
Ralph
Actions