Project

General

Profile

Actions

Bug #76918

closed

Story #69617: FormEngine bugs

selectMultipleSideBySide can't handle multiple selections with multiple set to true, if it's using items or itemsProcFunc

Added by Lars Peter Søndergaard almost 8 years ago. Updated over 5 years ago.

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

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
On Location Sprint

Description

The rendered selectMultipleSideBySide form filters duplicates when I wouldn't expect it to.

Steps to reproduce:

Have a field with a TCA configuration like the following (In my case I extended the pages table):

    'lfm_row_selection' => [
        'label' => 'Test Field',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectMultipleSideBySide',
            'items' => [
                ['Item 1', 1],
                ['Item 2', 2],
                ['Item 3', 3],
                ['Item 4', 4],
            ],
            'multiple' => true,
            'minitems' => 0,
            'maxitems' => 999,
        ],
    ],

The selectMultipleSideBySide is rendered correctly when editing the page, and adding the choices multiple times works as well. When saving, the choices are correctly stored multiple times, in the database field.

However, when entering the editing view again after saving, the left side of the selectMultipleSideBySide only shows unique entries, i.e. the duplicates that were provided have been filtered out.

I was able to track it down to the actual culprint in: sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php at the end of processSelectFieldValue (somewhere here).

This probably works fine for MM fields, because even if multiple entries are added in that case, it would still create a unique entry for each duplicated reference. But in the case of using 'items' or 'itemsProcFunc' it will fail because of the array_unique at the end.

I was able to kinda circumvent it by replacing the TcaSelectItems (that calls processSelectFieldValue on it's base class) class with a copy that simply extends TcaSelectItems and overrides processSelectFieldValue. You can see that here also ext_localconf.php.

This, however, feels kinda hack-ish and I really don't want to do that. I couldn't find any open or closed issues regarding that, and it also doesn't look like there is any TCA config option to circumwent that problem.

Greetings
Lars

Actions #1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49981

Actions #2

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49981

Actions #3

Updated by Christian Kuhn over 7 years ago

  • Description updated (diff)
  • Parent task set to #69617
Actions #4

Updated by Jan Helke over 7 years ago

  • Sprint Focus set to On Location Sprint
Actions #5

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49981

Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49981

Actions #7

Updated by Gerrit Code Review over 7 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/49981

Actions #8

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50140

Actions #9

Updated by Anonymous over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF