[TASK] Correct isTargetRenderType for FormDataProviders 15/44515/3
authorAndreas Allacher <andreas@allacher.com>
Tue, 3 Nov 2015 15:25:07 +0000 (16:25 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 3 Nov 2015 17:13:32 +0000 (18:13 +0100)
The extracted isTargetRenderType method should
return true if the target renderType is found.
It relates to: https://review.typo3.org/44352

Change-Id: I024df940184958391b6d85203da34dfe1017697a
Resolves: #71285
Releases: master
Reviewed-on: https://review.typo3.org/44515
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectItems.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php

index 70522a4..52f15a7 100644 (file)
@@ -38,7 +38,7 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
             }
 
             // Make sure we are only processing supported renderTypes
-            if ($this->isTargetRenderType($fieldConfig)) {
+            if (!$this->isTargetRenderType($fieldConfig)) {
                 continue;
             }
 
@@ -89,13 +89,10 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
      */
     protected function isTargetRenderType(array $fieldConfig)
     {
-        if (!in_array(
+        return in_array(
             $fieldConfig['config']['renderType'],
             ['selectSingle', 'selectSingleBox', 'selectCheckBox', 'selectMultipleSideBySide'],
             true
-        )) {
-            return true;
-        }
-        return false;
+        );
     }
 }
index 13c76af..820265f 100644 (file)
@@ -42,7 +42,7 @@ class TcaSelectTreeItems extends AbstractItemProvider implements FormDataProvide
             }
 
             // Make sure we are only processing supported renderTypes
-            if ($this->isTargetRenderType($fieldConfig)) {
+            if (!$this->isTargetRenderType($fieldConfig)) {
                 continue;
             }
 
@@ -195,9 +195,6 @@ class TcaSelectTreeItems extends AbstractItemProvider implements FormDataProvide
      */
     protected function isTargetRenderType(array $fieldConfig)
     {
-        if ($fieldConfig['config']['renderType'] !== 'selectTree') {
-            return true;
-        }
-        return false;
+        return $fieldConfig['config']['renderType'] === 'selectTree';
     }
 }