Bug #68045
closedInline add of FAL images in flexform does not work
0%
Description
In a flexform field of an extension plugin I have defined an inline element for multiple FAL images. When I enable the button for adding a new element within the list
<enabledControls type="array"> <new>TRUE</new>...
the button appears but a 500 server error pops up. Debugging in typo3/sysext/backend/Classes/Form/Element/InlineElement.php showed that the configuration is not properly taken for the file reference but instead mixed up with serialized configuration parts.
Probably this part is not fully implemented yet?
The normal addition of references works but if you want to add several items to the middle of a long list it's a bit annoying to move them from the end to the middle.
The full flexform:
<el> <settings.images> <TCEforms> <label>Images</label> <config> <type>inline</type> <foreign_types type="array"> <numIndex index="2" type="array"> <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem> </numIndex> </foreign_types> <foreign_table>sys_file_reference</foreign_table> <foreign_field>uid_foreign</foreign_field> <foreign_sortby>sorting_foreign</foreign_sortby> <foreign_table_field>tablenames</foreign_table_field> <foreign_match_fields type="array"> <fieldname>image</fieldname> </foreign_match_fields> <foreign_label>uid_local</foreign_label> <foreign_selector>uid_local</foreign_selector> <maxitems>1000</maxitems> <foreign_selector_fieldTcaOverride type="array"> <config> <appearance> <elementBrowserType>file</elementBrowserType> <elementBrowserAllowed>jpg,png</elementBrowserAllowed> </appearance> </config> </foreign_selector_fieldTcaOverride> <appearance type="array"> <headerThumbnail> <field>uid_local</field> <width>50m</width> <height>50</height> </headerThumbnail> <createNewRelationLinkTitle>Add image</createNewRelationLinkTitle> <useSortable>TRUE</useSortable> <showPossibleLocalizationRecords>FALSE</showPossibleLocalizationRecords> <showRemovedLocalizationRecords>FALSE</showRemovedLocalizationRecords> <showSynchronizationLink>FALSE</showSynchronizationLink> <enabledControls type="array"> <info>TRUE</info> <new>TRUE</new> <dragdrop>TRUE</dragdrop> <sort>TRUE</sort> <hide>TRUE</hide> <delete>TRUE</delete> <localize></localize> </enabledControls> <levelLinksPosition>both</levelLinksPosition> </appearance> </config> </TCEforms> </settings.images> </el>
Using:
TYPO3 6.2.14
PHP 5.4.41-0+deb7u1
Files
Updated by Andreas Wolf about 9 years ago
Updated by Christopher Orth about 9 years ago
- File stacktrace.html stacktrace.html added
Not sure this should be fixed with #70918 but I still get a 500 server error with following FlexForm
<settings.media> <TCEforms> <label>Image</label> <config> <type>inline</type> <minitems>0</minitems> <maxitems>1</maxitems> <appearance type="array"> <createNewRelationLinkTitle>LLL:EXT:cms/locallang_ttc.xlf:media.addFileReference</createNewRelationLinkTitle> <enabledControls type="array"> <delete>1</delete> <dragdrop>1</dragdrop> <hide>1</hide> <info>1</info> <localize>1</localize> </enabledControls> <headerThumbnail type="array"> <field>uid_local</field> <height>45c</height> <width>45</width> </headerThumbnail> <useSortable>1</useSortable> <showAllLocalizationLink>0</showAllLocalizationLink> <showPossibleLocalizationRecords>0</showPossibleLocalizationRecords> <showRemovedLocalizationRecords>0</showRemovedLocalizationRecords> <showSynchronizationLink>0</showSynchronizationLink> </appearance> <behaviour type="array"> <localizationMode>select</localizationMode> <localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization> </behaviour> <foreign_field>uid_foreign</foreign_field> <foreign_label>uid_local</foreign_label> <foreign_match_fields type="array"> <fieldname>media</fieldname> </foreign_match_fields> <foreign_selector>uid_local</foreign_selector> <foreign_selector_fieldTcaOverride type="array"> <config type="array"> <appearance type="array"> <elementBrowserAllowed></elementBrowserAllowed> <elementBrowserType>file</elementBrowserType> </appearance> </config> </foreign_selector_fieldTcaOverride> <foreign_sortby>sorting_foreign</foreign_sortby> <foreign_table>sys_file_reference</foreign_table> <foreign_table_field>tablenames</foreign_table_field> </config> </TCEforms> </settings.media>
Attached you can find the full stacktrace.
TYPO3 7.6
PHP 5.6.14
Updated by David Frerich almost 9 years ago
The problem lies within the data given to the \TYPO3\CMS\Backend\Form\FormDataProvider\TcaFlexFetch
In initializeDataStructure / addData, the given $result has an empty array in $result['databaseRow'] for new records and an array with only the uid for existing records.
But the call to BackendUtility::getFlexFormDS depends on a full databaseRow.
Because of that the parent record with the flexform configuration cannot be loaded on an fal add call.
Updated by David Frerich almost 9 years ago
When changing:
'inlineParentRecord' => array( \TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca::class => array(),
to
'inlineParentRecord' => array( \TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow::class => array()), \TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca::class => array( 'depends' => array( \TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow::class, ) ),
in core\Configuration\DefaultConfiguration.php on line 650 (TYPO3 7.6.0) it works for flexform within existing records (editing) but not for new ones.
I guess the configuration of the FormDataProviders for inlineParentRecord is not correct for flexforms in combinations with fal inline records.
Updated by David Frerich almost 9 years ago
If you want to temporary fix this yourself (only after the record has been saved), add this to the ext_localconf.php of your extension:
if ((float)TYPO3_version >= 7.0) { // bugfix for inline fal images in flexforms (only after record with flexform has been saved) $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['inlineParentRecord'][\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow::class] = array(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['inlineParentRecord'][\TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca::class] = array( 'depends' => array( \TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEditRow::class, ) ); }
Updated by Morton Jonuschat almost 9 years ago
- Category changed from File Abstraction Layer (FAL) to FormEngine aka TCEforms
- Status changed from New to Resolved