Project

General

Profile

Actions

Bug #88624

closed

Backend selectTree PHP Warning

Added by Markus Klein over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Backend API
Target version:
-
Start date:
2019-06-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Due to undefined [config][items] of renderType=selectTree a PHP Warning is issued:

#1476107295: PHP Warning: array_column() expects parameter 1 to be array, null given in typo3_src_8.7/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRecordTitle.php line 241

The reason is that no FormDataProvider is generating the items array for a tree (only for all other types of select elements).

A cheap workaround is to add an empty items array to the TCA:

'category' => [
    'exclude' => false,
    'label' => 'Foo',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectTree',
        'foreign_table' => 'sys_category',
        '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',
        'items' => [],
        'minitems' => 1,
        'maxitems' => 1,
        'treeConfig' => [
            'parentField' => 'parent',
            'appearance' => [
                'expandAll' => true,
                'showHeader' => true,
                'maxLevels' => 2,
                'nonSelectableLevels' => '0,1'
            ],
        ]
    ],
],

The core needs a fix to handle the missing items array correctly.

We face this issue with a custom extension that uses this TCA inside a record that is nested with IRRE in the main record.
Main record: project
Nested record: assignment (relation to project and to sys_category)

Actions

Also available in: Atom PDF