[CLEANUP] make TCEmain::getInlineFieldType() more understandable
authorAndreas Wolf <andreas.wolf@ikt-werk.de>
Sat, 9 Jul 2011 11:24:36 +0000 (13:24 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Sat, 9 Jul 2011 13:28:05 +0000 (15:28 +0200)
With 933254e2e69df05b41ae1f3b026a8f4c6f8fc09d, the method was made more
complicated without an obvious need for that. This patch reverts these
change, plus moving the guard clause to the beginning with an early
return in it, thus making the structure even more obvious.

This change has been integrated into the original patch for 4.5.

Change-Id: I9e7d987158adad089880c2185467555659b1827c
Releases: 4.6
Reviewed-on: http://review.typo3.org/3186
Reviewed-by: Steffen Ritter
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
t3lib/class.t3lib_tcemain.php

index 5711f1e..5cf1728 100644 (file)
@@ -6290,22 +6290,20 @@ class t3lib_TCEmain {
         * @return      mixed           string: inline subtype (field|mm|list), boolean: FALSE
         */
        function getInlineFieldType($conf) {
-               if ($conf['type'] == 'inline') {
-                       if ($conf['foreign_table']) {
-                               if ($conf['foreign_field']) {
-                                       return 'field';
-                               } // the reference to the parent is stored in a pointer field in the child record
-                               elseif ($conf['MM'])
-                               {
-                                       return 'mm';
-                               } // regular MM intermediate table is used to store data
-                               else
-                               {
-                                       return 'list';
-                               } // an item list (separated by comma) is stored (like select type is doing)
-                       }
+               if ($conf['type'] !== 'inline' || !$conf['foreign_table']) {
+                       return FALSE;
+               }
+
+               if ($conf['foreign_field']) {
+                               // the reference to the parent is stored in a pointer field in the child record
+                       return 'field';
+               } elseif ($conf['MM']) {
+                               // regular MM intermediate table is used to store data
+                       return 'mm';
+               } else {
+                               // an item list (separated by comma) is stored (like select type is doing)
+                       return 'list';
                }
-               return FALSE;
        }