diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index 5057d1eae6bfe88adb1ce19fcf150936e916a1f6..c7d086122bfa25e054bc9286ced122e847c3cf62 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -198,7 +198,7 @@ class PageLayoutController if ($this->id) { // Compile language data for pid != 0 only. The language drop-down is not shown on pid 0 // since pid 0 can't be localized. - $pageTranslations = $this->getExistingPageTranslations(); + $pageTranslations = BackendUtility::getExistingPageTranslations($this->id); foreach ($pageTranslations as $pageTranslation) { $languageId = $pageTranslation[$GLOBALS['TCA']['pages']['ctrl']['languageField']]; if (isset($this->availableLanguages[$languageId])) { @@ -236,40 +236,6 @@ class PageLayoutController } } - /** - * Fetch all records of the current page ID. - * Does not check permissions. - */ - protected function getExistingPageTranslations(): array - { - if ($this->id === 0) { - return []; - } - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); - $queryBuilder->getRestrictions()->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) - ->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getBackendUser()->workspace)); - $result = $queryBuilder - ->select('*') - ->from('pages') - ->where( - $queryBuilder->expr()->eq( - $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'], - $queryBuilder->createNamedParameter($this->id, Connection::PARAM_INT) - ) - ) - ->executeQuery(); - - $rows = []; - while ($row = $result->fetchAssociative()) { - BackendUtility::workspaceOL('pages', $row, $this->getBackendUser()->workspace); - if ($row && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { - $rows[] = $row; - } - } - return $rows; - } - protected function getLocalizedPageRecord(int $languageId): ?array { if ($languageId === 0) { diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 27c02820c053fb02508c82be05c687204f1a78b3..5e1a124ec9a20d3c5389aaa51515ba5e4211ec2d 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -479,6 +479,42 @@ class BackendUtility return $row; } + /** + * Fetch all records of the given page ID. + * Does not check permissions. + * + * @internal + */ + public static function getExistingPageTranslations(int $pageUid): array + { + if ($pageUid === 0) { + return []; + } + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); + $queryBuilder->getRestrictions()->removeAll() + ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) + ->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, self::getBackendUserAuthentication()->workspace)); + $result = $queryBuilder + ->select('*') + ->from('pages') + ->where( + $queryBuilder->expr()->eq( + $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'], + $queryBuilder->createNamedParameter($pageUid, Connection::PARAM_INT) + ) + ) + ->executeQuery(); + + $rows = []; + while ($row = $result->fetchAssociative()) { + BackendUtility::workspaceOL('pages', $row, self::getBackendUserAuthentication()->workspace); + if ($row && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) { + $rows[] = $row; + } + } + return $rows; + } + /** * Opens the page tree to the specified page id *