[BUGFIX] Correct tooltips for pages in the page tree 16/58616/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Thu, 11 Oct 2018 14:32:48 +0000 (16:32 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 13 Oct 2018 11:16:35 +0000 (13:16 +0200)
Make tooltips for pages in the page tree correct (in case of shortcuts,
and mountpoints).

* add missing fields to selection in page tree Repository
required by BackendUtility->titleAttribForPages()
* add guard clauses for page 0 to avoid unnecessary processing
* fixes several notices

Resolves: #86631
Releases: master
Change-Id: Ia0229203b78ef8c58e066ef3a587c1de1ee0b975
Reviewed-on: https://review.typo3.org/58616
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/backend/Classes/Controller/Page/TreeController.php
typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index f33d46f..c7d8468 100644 (file)
@@ -180,7 +180,7 @@ class TreeController
         $this->showMountPathAboveMounts = (bool)($userTsConfig['options.']['pageTree.']['showPathAboveMounts'] ?? false);
         $backendUserConfiguration = GeneralUtility::makeInstance(BackendUserConfiguration::class);
         $this->expandedState = $backendUserConfiguration->get('BackendComponents.States.Pagetree');
-        if (is_object($this->expandedState->stateHash)) {
+        if (is_object($this->expandedState) && is_object($this->expandedState->stateHash)) {
             $this->expandedState = (array)$this->expandedState->stateHash;
         } else {
             $this->expandedState = $this->expandedState['stateHash'] ?: [];
@@ -242,10 +242,10 @@ class TreeController
             return [];
         }
 
-        $stopPageTree = $page['php_tree_stop'] && $depth > 0;
+        $stopPageTree = !empty($page['php_tree_stop']) && $depth > 0;
         $identifier = $entryPoint . '_' . $pageId;
-        $expanded = $page['expanded'] || (isset($this->expandedState[$identifier]) && $this->expandedState[$identifier]);
-        $backgroundColor = $this->backgroundColors[$pageId] ?: ($inheritedData['backgroundColor'] ?? '');
+        $expanded = !empty($page['expanded']) || (isset($this->expandedState[$identifier]) && $this->expandedState[$identifier]);
+        $backgroundColor = !empty($this->backgroundColors[$pageId]) ? $this->backgroundColors[$pageId] : ($inheritedData['backgroundColor'] ?? '');
 
         $suffix = '';
         $prefix = '';
@@ -291,7 +291,7 @@ class TreeController
             'icon' => $icon->getIdentifier(),
             'name' => $visibleText,
             'nameSourceField' => $nameSourceField,
-            'alias' => htmlspecialchars($page['alias'] ?: ''),
+            'alias' => htmlspecialchars($page['alias'] ?? ''),
             'prefix' => htmlspecialchars($prefix),
             'suffix' => htmlspecialchars($suffix),
             'locked' => is_array($lockInfo),
@@ -305,7 +305,7 @@ class TreeController
             'readableRootline' => $depth === 0 && $this->showMountPathAboveMounts ? $this->getMountPointPath($pageId) : '',
             'isMountPoint' => $depth === 0,
             'mountPoint' => $entryPoint,
-            'workspaceId' => $page['t3ver_oid'] ?: $pageId,
+            'workspaceId' => !empty($page['t3ver_oid']) ? $page['t3ver_oid'] : $pageId,
         ];
         if (!$stopPageTree) {
             foreach ($page['_children'] as $child) {
@@ -436,6 +436,9 @@ class TreeController
     {
         $classes = [];
 
+        if ($page['uid'] === 0) {
+            return '';
+        }
         $workspaceId = (int)$this->getBackendUser()->workspace;
         if ($workspaceId > 0 && ExtensionManagementUtility::isLoaded('workspaces')) {
             if ($page['t3ver_oid'] > 0 && (int)$page['t3ver_wsid'] === $workspaceId) {
index 9e8f29e..9b48a9c 100644 (file)
@@ -68,7 +68,11 @@ class PageTreeRepository
         'perms_groupid',
         'perms_group',
         'perms_everybody',
-        'mount_pid'
+        'mount_pid',
+        'shortcut',
+        'shortcut_mode',
+        'mount_pid_ol',
+        'url',
     ];
 
     /**
index 93436a7..0c9b5cd 100644 (file)
@@ -1488,6 +1488,10 @@ class BackendUtility
         $lang = static::getLanguageService();
         $parts = [];
         $parts[] = 'id=' . $row['uid'];
+        if ($row['uid'] === 0) {
+            $out = htmlspecialchars($parts[0]);
+            return $includeAttrib ? 'title="' . $out . '"' : $out;
+        }
         if ($row['alias']) {
             $parts[] = $lang->sL($GLOBALS['TCA']['pages']['columns']['alias']['label']) . ' ' . $row['alias'];
         }