Project

General

Profile

Actions

Bug #98656

closed

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

Added by Ralph Brugger over 1 year ago. Updated over 1 year ago.

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #94622: Introduce new TCA type "category"Closed2021-07-23

Actions
Actions #1

Updated by Andreas Kiessling over 1 year ago

I can confirm this with tt_address. I wanted to limit the selectable categories to the same page with the ###CURRENT_PID### marker --> does not work.

Isn't the order of execution wrong in this case? IMHO the TCA/Overrides should run AFTER the TCA is loaded from extension and the core, and so any generated config can be overriden. Having checks if the field is already defined and thus some fields are overriden, others are appended is not what i would expect

Actions #2

Updated by Oliver Bartsch over 1 year ago

Actions #3

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76440

Actions #4

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76415

Actions #5

Updated by Oliver Bartsch over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF