From bc615d9c45b400cb4f8886b431e9d0a331a65282 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= <ak@koehnlein.eu>
Date: Sat, 15 Apr 2023 16:45:41 +0200
Subject: [PATCH] [BUGFIX] Set table name even if record could not be found
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Set the variable `$linkParts['tableName']` even if the currently linked
record could not be found. The variable is required in later step to
show information, which also should be present for deleted records.

Resolves: #100611
Releases: main, 11.5
Change-Id: I3f5d1e53d8c6889c8907af5ff56c76eb74efa5fc
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78680
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Albrecht Köhnlein <ak@koehnlein.eu>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Albrecht Köhnlein <ak@koehnlein.eu>
---
 .../sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php
index 9ee27d6941cd..4f702961d6bd 100644
--- a/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php
+++ b/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php
@@ -93,10 +93,10 @@ class RecordLinkHandler extends AbstractLinkHandler implements LinkHandlerInterf
         if ($record === null) {
             $linkParts['title'] = $this->getLanguageService()->getLL('recordNotFound');
         } else {
-            $linkParts['tableName'] = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
             $linkParts['pid'] = (int)$record['pid'];
             $linkParts['title'] = !empty($linkParts['title']) ? $linkParts['title'] : BackendUtility::getRecordTitle($table, $record);
         }
+        $linkParts['tableName'] = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
         $linkParts['url']['type'] = $linkParts['type'];
         $this->linkParts = $linkParts;
 
-- 
GitLab