Revert "[BUGFIX] Remove early return in PageTreeDataProvider"
authorTolleiv Nietsch <info@tolleiv.de>
Wed, 8 Feb 2012 17:24:09 +0000 (18:24 +0100)
committerTolleiv Nietsch <info@tolleiv.de>
Wed, 8 Feb 2012 17:35:33 +0000 (18:35 +0100)
This reverts commit 183c50043417a7f8d29d734bfd6f2bd0fac021cf

The related commit was merged by accident.

Change-Id: I32a0ff98d3cdaaa95b8a3ea50ab5eb90c0a22e39
Reviewed-on: http://review.typo3.org/8916
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php

index b0077f2..4cd6f23 100644 (file)
@@ -120,31 +120,31 @@ class t3lib_tree_pagetree_DataProvider extends t3lib_tree_AbstractDataProvider {
                }
 
                $subpages = $this->getSubpages($node->getId());
-               if (is_array($subpages) && count($subpages) > 0) {
-
-                       foreach ($subpages as $subpage) {
-                               if (in_array($subpage['uid'], $this->hiddenRecords)) {
-                                       continue;
-                               }
+               if (!is_array($subpages) || !count($subpages)) {
+                       return $nodeCollection;
+               }
 
-                               $subpage = t3lib_befunc::getRecordWSOL('pages', $subpage['uid'], '*', '', TRUE, TRUE);
-                               if (!$subpage) {
-                                       continue;
-                               }
+               foreach ($subpages as $subpage) {
+                       if (in_array($subpage['uid'], $this->hiddenRecords)) {
+                               continue;
+                       }
 
-                               $subNode = t3lib_tree_pagetree_Commands::getNewNode($subpage, $mountPoint);
-                               if ($this->nodeCounter < $this->nodeLimit) {
-                                       $childNodes = $this->getNodes($subNode, $mountPoint, $level + 1);
-                                       $subNode->setChildNodes($childNodes);
-                                       $this->nodeCounter += $childNodes->count();
-                               } else {
-                                       $subNode->setLeaf(!$this->hasNodeSubPages($subNode->getId()));
-                               }
+                       $subpage = t3lib_befunc::getRecordWSOL('pages', $subpage['uid'], '*', '', TRUE, TRUE);
+                       if (!$subpage) {
+                               continue;
+                       }
 
-                               $nodeCollection->append($subNode);
+                       $subNode = t3lib_tree_pagetree_Commands::getNewNode($subpage, $mountPoint);
+                       if ($this->nodeCounter < $this->nodeLimit) {
+                               $childNodes = $this->getNodes($subNode, $mountPoint, $level + 1);
+                               $subNode->setChildNodes($childNodes);
+                               $this->nodeCounter += $childNodes->count();
+                       } else {
+                               $subNode->setLeaf(!$this->hasNodeSubPages($subNode->getId()));
                        }
-               }
 
+                       $nodeCollection->append($subNode);
+               }
 
                foreach ($this->processCollectionHookObjects as $hookObject) {
                        /** @var $hookObject t3lib_tree_pagetree_interfaces_collectionprocessor */