itemsProcFunc_config -> indexField not working in TYPO3 9
according to the documentation the following TCA configuration should work and result in a list of countries with their ISO-2 code as identifier
'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'static_countries', 'items' => [ ['', ''], ], 'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCountriesSelector', 'itemsProcFunc_config' => [ 'indexField' => 'cn_iso_2', ], 'size' => 1, 'minitems' => 1, 'maxitems' => 1, 'eval' => 'required', 'default' => 'DE', ],
Unfortunately this is not the case, because in TYPO3 v9 (and likely also v8, haven't checked yet) the itemsProcFunc is processed BEFORE TYPO3 fetches the records from the foreign_table. But the itemsProcFunc expects the `items` array to be filled already before it does it's magic. And because it's empty at that point, the procFunc exits early. TYPO3 then fetches the foreign_table some point later and you end up with an unprocessed list of countries (etc).
The only "solution" that comes to my mind would be to write a custom dataProcessor that is executed after `\TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems` and does it's magic then (by triggering the itemsProcFunc assigned to a custom TCA config value so that the TYPO3 core doesn't call it)