[BUGFIX] FormEngine: Keep columns from overruleTypesArray for processing 36/43936/3
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 9 Oct 2015 13:58:53 +0000 (15:58 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 9 Oct 2015 14:16:43 +0000 (16:16 +0200)
If a showitem configuration is overruled, use that information to select
the columns that need to be kept for processing/display.

Resolves: #70540
Releases: master
Change-Id: I9ce53e0bb815775e6dfead0645ba0533158d440d
Reviewed-on: http://review.typo3.org/43936
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessShowitem.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaColumnsProcessShowitemTest.php

index 83c2e7a..d53ce93 100644 (file)
@@ -40,7 +40,9 @@ class TcaColumnsProcessShowitem implements FormDataProviderInterface
             return $result;
         }
 
-        $showItemFieldString = $result['processedTca']['types'][$recordTypeValue]['showitem'];
+        $showItemFieldString = !empty($result['overruleTypesArray'][$recordTypeValue]['showitem'])
+            ? $result['overruleTypesArray'][$recordTypeValue]['showitem']
+            : $result['processedTca']['types'][$recordTypeValue]['showitem'];
         $showItemFieldArray = GeneralUtility::trimExplode(',', $showItemFieldString, true);
 
         foreach ($showItemFieldArray as $fieldConfigurationString) {
index 8096835..201901e 100644 (file)
@@ -71,6 +71,47 @@ class TcaColumnsProcessShowitemTest extends UnitTestCase
     /**
      * @test
      */
+    public function addDataRegistersColumnsFieldReferencedInOverruledShowitems()
+    {
+        $input = [
+            'columnsToProcess' => [],
+            'databaseRow' => [],
+            'recordTypeValue' => 'aType',
+            'overruleTypesArray' => [
+                'aType' => [
+                    'showitem' => 'keepMe'
+                ]
+            ],
+            'processedTca' => [
+                'types' => [
+                    'aType' => [
+                        'showitem' => 'aField'
+                    ],
+                ],
+                'columns' => [
+                    'keepMe' => [
+                        'config' => [
+                            'type' => 'input',
+                        ]
+                    ],
+                    'aField' => [
+                        'config' => [
+                            'type' => 'input',
+                        ]
+                    ]
+                ]
+            ]
+        ];
+
+        $expected = $input;
+        $expected['columnsToProcess'] = ['keepMe'];
+
+        $this->assertSame($expected, $this->subject->addData($input));
+    }
+
+    /**
+     * @test
+     */
     public function addDataKeepsColumnsFieldReferencedInPalette()
     {
         $input = [