Issue Bug Closed

#102616TCA type selectSingle with itemsProcFunc doesn't show information in list view nor in export CSV

Florian Rival 12/06/23, 15:32 updated 07/09/24, 15:12

Description

If you define a TCA field like this :

'my_col' => [
    'exclude' => false,
    'label' => 'My col label',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'default' => 'value-1',
        'itemsProcFunc' => \Vendor\MyExtUserFunc\TcaUserFunc::class ::class . '->getMyCol'
    ]
]

with itemsProcFunc like this :

public function getMyCol(&$parameters): void
{
    $parameters['items'][] = ['Label value 1', 'value-1'];
    $parameters['items'][] = ['Label value 2', 'value-2'];
}

In BE list view, if you want to display the ‘my_col’ value – or export it into CSV – by setting ‘show columns’ ‘my_col’ to true, the field show the value instead of the translation. I.e. ‘value-1’ or ‘value-2’ instead of ‘Label value 1’ or ‘Label value 2’.

While it works well with TCA like this :

'getMyCol' => [
    'exclude' => false,
    'label' => 'My col label',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'default' => 'value-1',
        'items' => [
          ['Label value 1', 'value-1'],
          ['Label value 2', 'value-2'],
        ]
    ]
]

Same problem as this one https://forge.typo3.org/issues/100855

Reviews 4