Issue Bug Closed

#88624Backend selectTree PHP Warning

Markus Klein 06/24/19, 18:43 updated 12/23/19, 22:49

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)

Reviews 3