From 8d400de98e1155434deff8d487c7a7214d5e6df0 Mon Sep 17 00:00:00 2001 From: Sybille Peters <sypets@gmx.de> Date: Sat, 22 Jul 2023 15:19:11 +0200 Subject: [PATCH] [BUGFIX] Alert about deleting content elements with references If deleting content elements which have references to it, a confirm dialog is displayed asking if the element should really be deleted. Usually, the dialog message contains information about existing references (if there are references). This was not the case if the content element is deleted by using the inline delete button in the page module in TYPO3 v11. This behaviour was already improved and streamlined in TYPO3 v12. This is a partial backport of functionality in patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/72001 to backport the most critical functionality improvement. Releases: 11.5 Resolves: #101414 Related: #101411 Related: #92670 Related: #94780 Change-Id: Ie3ecad8f38a862c652baf115719b207820865708 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80116 Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Garvin Hicking <gh@faktor-e.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Garvin Hicking <gh@faktor-e.de> --- .../View/BackendLayout/Grid/GridColumnItem.php | 15 +++++++++++++++ .../Partials/PageLayout/RecordDefault/Header.html | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php index 064679ccb083..03393bfcfc27 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php +++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php @@ -130,6 +130,21 @@ class GridColumnItem extends AbstractGridObject return BackendUtility::getLinkToDataHandlerAction($params); } + public function getDeleteMessage(): string + { + $refCountMsg = BackendUtility::referenceCount( + 'tt_content', + $this->record['uid'], + LF . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.referencesToRecord') + ) . BackendUtility::translationCount( + 'tt_content', + $this->record['uid'], + LF . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.translationsOfRecord') + ); + + return $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteWarning') . $refCountMsg; + } + public function getFooterInfo(): string { $record = $this->getRecord(); diff --git a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/RecordDefault/Header.html b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/RecordDefault/Header.html index b2e5f52624cc..8219e48390be 100644 --- a/typo3/sysext/backend/Resources/Private/Partials/PageLayout/RecordDefault/Header.html +++ b/typo3/sysext/backend/Resources/Private/Partials/PageLayout/RecordDefault/Header.html @@ -23,7 +23,8 @@ <a class="btn btn-default t3js-modal-trigger" href="{item.deleteUrl}" data-severity="warning" data-title="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')}" - data-bs-content="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')}" + data-bs-content="{item.deleteMessage}" + data-button-ok-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete')}" data-button-close-text="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}" title="{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteItem')}"> <core:icon identifier="actions-edit-delete" size="small" /> -- GitLab