[BUGFIX] Remove early return in PageTreeDataProvider
authorGeorg Ringer <mail@ringerge.org>
Wed, 8 Feb 2012 12:21:12 +0000 (13:21 +0100)
committerTolleiv Nietsch <info@tolleiv.de>
Wed, 8 Feb 2012 17:23:48 +0000 (18:23 +0100)
t3lib_tree_pagetree_Data_Provider does an early
return which makes it impossible to use the hook
which comes some lines later

Change-Id: If79cc4d7d6719e3e978db42fa0be7006089e1162
Resolves: #33761
Releases: 4.7, 4.6
Reviewed-on: http://review.typo3.org/8904
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php

index 4cd6f23..b0077f2 100644 (file)
@@ -120,32 +120,32 @@ class t3lib_tree_pagetree_DataProvider extends t3lib_tree_AbstractDataProvider {
                }
 
                $subpages = $this->getSubpages($node->getId());
-               if (!is_array($subpages) || !count($subpages)) {
-                       return $nodeCollection;
-               }
+               if (is_array($subpages) && count($subpages) > 0) {
 
-               foreach ($subpages as $subpage) {
-                       if (in_array($subpage['uid'], $this->hiddenRecords)) {
-                               continue;
-                       }
+                       foreach ($subpages as $subpage) {
+                               if (in_array($subpage['uid'], $this->hiddenRecords)) {
+                                       continue;
+                               }
 
-                       $subpage = t3lib_befunc::getRecordWSOL('pages', $subpage['uid'], '*', '', TRUE, TRUE);
-                       if (!$subpage) {
-                               continue;
-                       }
+                               $subpage = t3lib_befunc::getRecordWSOL('pages', $subpage['uid'], '*', '', TRUE, TRUE);
+                               if (!$subpage) {
+                                       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()));
-                       }
+                               $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);
+                               $nodeCollection->append($subNode);
+                       }
                }
 
+
                foreach ($this->processCollectionHookObjects as $hookObject) {
                        /** @var $hookObject t3lib_tree_pagetree_interfaces_collectionprocessor */
                        $hookObject->postProcessGetNodes($node, $mountPoint, $level, $nodeCollection);