Project

General

Profile

Bug #76918

Updated by Christian Kuhn over 7 years ago


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

 h2. Steps to reproduce: 

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

 <pre> 
     '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, 
         ], 
     ], 
 </pre> 

 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":https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php#L1165). 

 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":https://github.com/lsoendergaard/dyn-backend-layout/blob/master/Classes/Form/FormDataProvider/TcaSelectItems.php also "ext_localconf.php":https://github.com/lsoendergaard/dyn-backend-layout/blob/master/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

Back