Bug #76918
closedStory #69617: FormEngine bugs
selectMultipleSideBySide can't handle multiple selections with multiple set to true, if it's using items or itemsProcFunc
100%
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
Updated by Gerrit Code Review over 8 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
Updated by Gerrit Code Review over 8 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
Updated by Christian Kuhn over 8 years ago
- Description updated (diff)
- Parent task set to #69617
Updated by Gerrit Code Review over 8 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
Updated by Gerrit Code Review over 8 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
Updated by Gerrit Code Review over 8 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
Updated by Gerrit Code Review over 8 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
Updated by Anonymous over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 12b9bfcf0159f05380e83e194bc8cda546df84a5.