Project

General

Profile

Actions

Bug #103825

closed

Undefined array key "foreign_table" in TcaInputPlaceholders

Added by Robert Vock 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2024-05-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When you're using a select field as placeholder for a textfield in TCA, you get an Undefined array key "foreign_table" in TcaInputPlaceholders warning in PHP 8.

TCA:


$GLOBALS['TCA']['tt_content']['columns']['fieldname'] = [
    'label' => 'Fieldlabel',
    'config' => [
        'type' => 'input',
        'eval' => 'trim',
        'placeholder' => '__row|CType',
    ],
];

Relevant Code-Position:
https://github.com/TYPO3/typo3/blob/2acd0592d211663ba3d29cb2aafe1344d04f9f0b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInputPlaceholders.php#L123

switch ($fieldConfig['type']) {
    case 'select':
    case 'category':
        // The FormDataProviders already resolved the select items to an array of uids,
        // filter out empty values that occur when no related record has been selected.
        $possibleUids = array_filter($value);
        $foreignTableName = $fieldConfig['foreign_table'];
        break;

It's not guaranteed, that the foreign_table key is set for all select types.

Actions

Also available in: Atom PDF