Skip to content
Snippets Groups Projects
Commit 12ecfd34 authored by Andreas Fernandez's avatar Andreas Fernandez
Browse files

[BUGFIX] Always load label for edit notification

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: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 23e8c8bc
Branches
Tags
No related merge requests found
......@@ -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);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment