Flexform: Support ds_pointerField pointing to a foreign record
The field defined in
ds_pointerField decides which FlexForm should be displayed so you can have different FlexForms for different "types" of records. I'm proposing to add the ability to read a related foreign field which determines which FlexForm to use.
Real world example: I want to display a FlexForm in sys_file_reference based on the mime type the file has. But the mime type is not available in the sys_file_reference record but in the related sys_file record.
(See https://forge.typo3.org/issues/77710 for more information on the real world example)
Im proposing to use the following syntax, which divides local and foreign field by colon:
$GLOBALS['TCA']['sys_file_reference']['columns']['mediaoptions'] = [ 'label' => 'Options', 'config' => [ 'type' => 'flex', 'ds_pointerField' => 'uid_local:mime_type', 'ds' => [ 'video/vimeo' => 'FILE:EXT:mediaoptions/Configuration/FlexForms/Vimeo.xml', 'video/youtube' => 'FILE:EXT:mediaoptions/Configuration/FlexForms/YouTube.xml', ], ], ];
I'm proposing this syntax because since TYPO3 4.7 there's already a very similar functionality for the
For my real world extension I already solved this via a hook: https://github.com/smichaelsen/typo3-mediaoptions/blob/master/Classes/Hooks/GetFlexformDataStructureHook.php
(Tested only with TYPO3 7 so far)
Any feedback is welcome.
#3 Updated by Riccardo De Contardi over 2 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
No feedback within 90 days > closing this issue.
If you think that this is the wrong decision, please reopen it or open a new issue with a reference to this one. Thank you.