Issue Bug Closed

#98656Overriding ['TCA']['pages']['columns']['categories']['config']['foreign_table_where'] does not work

Ralph Brugger 10/19/22, 06:52 updated 12/06/22, 21:52

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

Reviews 3