[BUGFIX] Overlay workspace records in Live Search 97/60497/2
authorBenni Mack <benni@typo3.org>
Wed, 17 Apr 2019 18:39:20 +0000 (20:39 +0200)
committerDaniel Goerz <daniel.goerz@posteo.de>
Wed, 24 Apr 2019 18:01:20 +0000 (20:01 +0200)
The live search in the top right corner should detect and find
records of the current workspace.

A protected method which was unused is also removed.

Resolves: #36282
Releases: master, 9.5
Change-Id: I759e4f6dbd0c1676d9800d8319caf8b93ec0ecc5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60497
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/backend/Classes/Search/LiveSearch/LiveSearch.php

index ae0d7b8..5ea1cf9 100644 (file)
@@ -121,22 +121,6 @@ class LiveSearch
     }
 
     /**
-     * Retrieve the page record from given $id.
-     *
-     * @param int $id
-     * @return array
-     */
-    protected function findPageById($id)
-    {
-        $pageRecord = [];
-        $row = BackendUtility::getRecord(self::PAGE_JUMP_TABLE, $id);
-        if (is_array($row)) {
-            $pageRecord = $row;
-        }
-        return $pageRecord;
-    }
-
-    /**
      * Find records from all registered TCA table & column values.
      *
      * @param array $pageIdList Comma separated list of page IDs
@@ -239,8 +223,13 @@ class LiveSearch
         $result = $queryBuilder->execute();
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         while ($row = $result->fetch()) {
+            BackendUtility::workspaceOL($tableName, $row);
+            if (!is_array($row)) {
+                continue;
+            }
+            $onlineUid = $row['t3ver_oid'] ?: $row['uid'];
             $title = 'id=' . $row['uid'] . ', pid=' . $row['pid'];
-            $collect[] = [
+            $collect[$onlineUid] = [
                 'id' => $tableName . ':' . $row['uid'],
                 'pageId' => $tableName === 'pages' ? $row['uid'] : $row['pid'],
                 'typeLabel' =>  htmlspecialchars($this->getTitleOfCurrentRecordType($tableName)),