Project

General

Profile

Actions

Bug #68045

closed

Inline add of FAL images in flexform does not work

Added by Stefan Terborg almost 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2015-07-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

stacktrace.html (8.66 KB) stacktrace.html Christopher Orth, 2015-11-18 13:40

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #70918: Adding inline relations in FlexForms is brokenClosed2015-10-21

Actions
Related to TYPO3 Core - Bug #71436: Inline in flex with multiple DS failsClosed2015-11-09

Actions
Actions #1

Updated by Andreas Wolf over 8 years ago

#70918 and this are similar issues, but are not related, as the reason for #70918 apparently is a bug in the refactored FormEngine.

Actions #2

Updated by Christopher Orth over 8 years ago

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

Actions #3

Updated by David Frerich over 8 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.

Actions #4

Updated by David Frerich over 8 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.

Actions #5

Updated by David Frerich over 8 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,
        )
    );
}
Actions #6

Updated by Morton Jonuschat over 8 years ago

  • Category changed from File Abstraction Layer (FAL) to FormEngine aka TCEforms
  • Status changed from New to Resolved

This has been resolved with commit 570e19ed / issue #71436

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Actions #7

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF