Skip to content

Commit

Permalink
[BUGFIX] Fix AddNewsToMenuProcessor for 12 #2236
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer authored Oct 25, 2023
1 parent 521ae05 commit 9278834
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Classes/DataProcessing/AddNewsToMenuProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -131,6 +137,11 @@ protected function getCurrentLanguage(): int
return (int)$languageId;
}

protected function getCurrentLanguageAspect(): LanguageAspect
{
return GeneralUtility::makeInstance(Context::class)->getAspect('language');
}

/**
* @return TypoScriptFrontendController
*/
Expand Down

0 comments on commit 9278834

Please sign in to comment.