From 12ecfd34a1bd4a4d33465e9fedaf6b3a906da89a Mon Sep 17 00:00:00 2001 From: Andreas Fernandez <a.fernandez@scripting-base.de> Date: Sun, 14 Aug 2022 11:56:30 +0200 Subject: [PATCH] [BUGFIX] Always load label for edit notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a record is edited via single field mode (aka "columnsOnly"), the label field as defined via TCA may be missing, rendering "[No title]" in the notification message. Before compiling the notification message, it is now checked whether the label exists already. If not, the label of the record is fetched from the database, if such label field is configured via TCA at all. Resolves: #98142 Releases: main Change-Id: I2babfcae354b1fad15c653e61449353cd2efb8a4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75443 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> --- .../Controller/EditDocumentController.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index 32ab9e179791..70954508bb1b 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -653,6 +653,22 @@ class EditDocumentController $realUidInPayload = ($tceSubstId = array_search($uid, $tce->substNEWwithIDs, true)) !== false ? $tceSubstId : $uid; $row = $this->data[$table][$uid] ?? $this->data[$table][$realUidInPayload] ?? null; if ($row !== null) { + if ($this->columnsOnly) { + // If label of the record is not available, fetch it from database + // This is the case when EditDocumentController is booted in single field mode (e.g. Template module > 'info/modify' > edit 'setup' field) + $labelArray = [$GLOBALS['TCA'][$table]['ctrl']['label'] ?? null]; + $labelAltArray = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'] ?? '', true); + $labelFields = array_unique(array_filter(array_merge($labelArray, $labelAltArray))); + foreach ($labelFields as $labelField) { + if (!isset($row[$labelField])) { + $tmpRecord = BackendUtility::getRecord($table, $uid, implode(',', $labelFields)); + if ($tmpRecord !== null) { + $row = array_merge($row, $tmpRecord); + } + break; + } + } + } $recordTitle = GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $row), (int)$this->getBackendUser()->uc['titleLen']); $messages[] = sprintf($this->getLanguageService()->getLL('notification.record_saved.message'), $recordTitle); } -- GitLab