diff --git a/Classes/DataProcessing/AddNewsToMenuProcessor.php b/Classes/DataProcessing/AddNewsToMenuProcessor.php index c74674eb90..420ff1bf3e 100644 --- a/Classes/DataProcessing/AddNewsToMenuProcessor.php +++ b/Classes/DataProcessing/AddNewsToMenuProcessor.php @@ -13,7 +13,9 @@ use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException; +use TYPO3\CMS\Core\Context\LanguageAspect; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface; @@ -102,8 +104,12 @@ protected function getNewsRecord(): array ->executeQuery()->fetchAssociative(); if ($row) { - // @extensionScannerIgnoreLine - $row = $this->getTsfe()->sys_page->getRecordOverlay('tx_news_domain_model_news', $row, $this->getCurrentLanguage()); + if ((new Typo3Version())->getMajorVersion() >= 12) { + $row = $this->getTsfe()->sys_page->getLanguageOverlay('tx_news_domain_model_news', $row, $this->getCurrentLanguageAspect()); + } else { + // @extensionScannerIgnoreLine + $row = $this->getTsfe()->sys_page->getRecordOverlay('tx_news_domain_model_news', $row, $this->getCurrentLanguage()); + } } if (is_array($row) && !empty($row)) { @@ -131,6 +137,11 @@ protected function getCurrentLanguage(): int return (int)$languageId; } + protected function getCurrentLanguageAspect(): LanguageAspect + { + return GeneralUtility::makeInstance(Context::class)->getAspect('language'); + } + /** * @return TypoScriptFrontendController */