[BUGFIX] Use correct check to find site root pages 56/51756/3
authorGeorg Ringer <georg.ringer@gmail.com>
Sun, 19 Feb 2017 17:47:45 +0000 (18:47 +0100)
committerSascha Egerer <sascha@sascha-egerer.de>
Sun, 19 Feb 2017 20:29:28 +0000 (21:29 +0100)
The change #79857 introduced a wrong check to find the
site root pages. Instead of checking pid == 0, the field
is_siteroot must be used.

Resolves: #79897
Releases: master
Change-Id: Ibfff703fc9506505f860c051f65dc3d31083eb1e
Reviewed-on: https://review.typo3.org/51756
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/PageTreeView.php

index afd4c79..7d7a8b3 100644 (file)
@@ -149,7 +149,7 @@ abstract class AbstractTreeView
      * @see addField()
      * @var array
      */
-    public $fieldArray = ['uid', 'pid', 'title'];
+    public $fieldArray = ['uid', 'pid', 'title', 'is_siteroot'];
 
     /**
      * List of other fields which are ALLOWED to set (here, based on the "pages" table!)
@@ -689,7 +689,7 @@ abstract class AbstractTreeView
         }
         $title = $this->showDefaultTitleAttribute ? htmlspecialchars('UID: ' . $row['uid']) : $this->getTitleAttrib($row);
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
-        $icon = $row['pid'] === 0 ? $iconFactory->getIcon('apps-pagetree-folder-root', Icon::SIZE_SMALL) : $iconFactory->getIconForRecord($this->table, $row, Icon::SIZE_SMALL);
+        $icon = $row['is_siteroot'] ? $iconFactory->getIcon('apps-pagetree-folder-root', Icon::SIZE_SMALL) : $iconFactory->getIconForRecord($this->table, $row, Icon::SIZE_SMALL);
         $icon = '<span title="' . $title . '">' . $icon->render() . '</span>';
         return $this->wrapIcon($icon, $row);
     }
index 6c2ecbc..3352086 100644 (file)
@@ -27,6 +27,7 @@ class PageTreeView extends AbstractTreeView
     public $fieldArray = [
         'uid',
         'pid',
+        'is_siteroot',
         'title',
         'doktype',
         'nav_title',