From 70e2d2f676155cf09c56ca8c4b388902ed0e27ac Mon Sep 17 00:00:00 2001 From: Andreas Fernandez <a.fernandez@scripting-base.de> Date: Thu, 15 Feb 2018 20:03:55 +0100 Subject: [PATCH] =?UTF-8?q?[BUGFIX]=20Use=20language=20fields=20as=20defin?= =?UTF-8?q?ed=20in=20TCA=20for=20=E2=80=9EDuplicate=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I123e6dae9b0b6a5bb68261bc9ae5aaf75a64822d Resolves: #83926 Related: #83892 Releases: master Reviewed-on: https://review.typo3.org/55741 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com> Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Controller/EditDocumentController.php | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index dcb24e8749ba..d489e05b9b03 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -1330,23 +1330,21 @@ class EditDocumentController $buttonBar->addButton($closeButton); // DUPLICATE button: $record = BackendUtility::getRecord($this->firstEl['table'], $this->firstEl['uid']); - $l18nParent = $record['l18n_parent'] ?? 0; - $sysLanguageUid = $record['sys_language_uid'] ?? 0; + $TCActrl = $GLOBALS['TCA'][$this->firstEl['table']]['ctrl']; + $l18nParent = isset($TCActrl['transOrigPointerField'], $record[$TCActrl['transOrigPointerField']]) + ? (int)$record[$TCActrl['transOrigPointerField']] + : 0; + $sysLanguageUid = isset($TCActrl['languageField'], $record[$TCActrl['languageField']]) + ? (int)$record[$TCActrl['languageField']] + : 0; $showDuplicateButton = false; if ($this->firstEl['cmd'] !== 'new' && MathUtility::canBeInterpretedAsInteger($this->firstEl['uid'])) { - // Special case: pages - if ($this->firstEl['table'] === 'pages') { - // show button only, if record is in default language - $showDuplicateButton = (int)$sysLanguageUid === 0; + if ($sysLanguageUid === 0) { + // show button, if record is in default language + $showDuplicateButton = true; } else { - // not pages table - if ((int)$sysLanguageUid === 0) { - // show button, if record is in default language - $showDuplicateButton = true; - } else { - // show button, if record is NOT in default language AND has no parent - $showDuplicateButton = (int)$l18nParent === 0; - } + // show button, if record is NOT in default language AND has no parent + $showDuplicateButton = $l18nParent === 0; } } if ($showDuplicateButton) { -- GitLab