From 4e3ddbc262e6820b9f4a7ccee5ecabd6f1de91d1 Mon Sep 17 00:00:00 2001
From: Matthias Adrowski <matthias.adrowski@sgalinski.de>
Date: Mon, 10 Jan 2022 15:24:48 +0100
Subject: [PATCH] [TASK] Fix rector error, add version for languageMode

---
 Classes/Utility/BackendNewsUtility.php |  9 ++++--
 ext_localconf.php                      | 42 +++++++++++++-------------
 ext_tables.php                         |  4 +--
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/Classes/Utility/BackendNewsUtility.php b/Classes/Utility/BackendNewsUtility.php
index 10ae224..456536c 100644
--- a/Classes/Utility/BackendNewsUtility.php
+++ b/Classes/Utility/BackendNewsUtility.php
@@ -207,7 +207,10 @@ class BackendNewsUtility {
 		$querySettings = $query->getQuerySettings();
 		$querySettings->setLanguageUid($languageUid);
 		$querySettings->setLanguageOverlayMode(TRUE);
-		$querySettings->setLanguageMode('content_fallback');
+		if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
+			$querySettings->setLanguageMode('content_fallback');
+		}
+
 		$query->setQuerySettings($querySettings);
 		if ($pageUid) {
 			$rootline = BackendUtility::BEgetRootLine($pageUid, '', TRUE);
@@ -262,7 +265,9 @@ class BackendNewsUtility {
 		$querySettings = $query->getQuerySettings();
 		$querySettings->setLanguageUid($languageUid);
 		$querySettings->setLanguageOverlayMode(TRUE);
-		$querySettings->setLanguageMode('content_fallback');
+		if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
+			$querySettings->setLanguageMode('content_fallback');
+		}
 		$query->setQuerySettings($querySettings);
 		if ($newsItemUid) {
 			$query->matching($query->equals('uid', $newsItemUid));
diff --git a/ext_localconf.php b/ext_localconf.php
index fd085a5..a6b752b 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -33,52 +33,52 @@ call_user_func(
 
 		// plugin configurations
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'Overview',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\OverviewController::class => 'overview',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\OverviewController::class => '',]
+			[\SGalinski\SgNews\Controller\OverviewController::class => 'overview',],
+			[\SGalinski\SgNews\Controller\OverviewController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'ListByCategory',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\ListByCategoryController::class => 'index',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\ListByCategoryController::class => '',]
+			[\SGalinski\SgNews\Controller\ListByCategoryController::class => 'index',],
+			[\SGalinski\SgNews\Controller\ListByCategoryController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'SingleView',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\SingleViewController::class => 'singleView',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\SingleViewController::class => '',]
+			[\SGalinski\SgNews\Controller\SingleViewController::class => 'singleView',],
+			[\SGalinski\SgNews\Controller\SingleViewController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'NewsFeed',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\NewsFeedController::class => 'index',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\NewsFeedController::class => '',]
+			[\SGalinski\SgNews\Controller\NewsFeedController::class => 'index',],
+			[\SGalinski\SgNews\Controller\NewsFeedController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'Latest',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\LatestController::class => 'index',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\LatestController::class => '',]
+			[\SGalinski\SgNews\Controller\LatestController::class => 'index',],
+			[\SGalinski\SgNews\Controller\LatestController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'ListByCategory',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\ListByCategoryController::class => 'index',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\ListByCategoryController::class => '',]
+			[\SGalinski\SgNews\Controller\ListByCategoryController::class => 'index',],
+			[\SGalinski\SgNews\Controller\ListByCategoryController::class => '',]
 		);
 
 		\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
-			'Srectorprefix20211231gNews',
+			'SgNews',
 			'NewsByAuthor',
-			[\SGalinski\Srectorprefix20211231gNews\Controller\NewsByAuthorController::class => 'list',],
-			[\SGalinski\Srectorprefix20211231gNews\Controller\NewsByAuthorController::class => '',]
+			[\SGalinski\SgNews\Controller\NewsByAuthorController::class => 'list',],
+			[\SGalinski\SgNews\Controller\NewsByAuthorController::class => '',]
 		);
 
 		if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_ajax')) {
diff --git a/ext_tables.php b/ext_tables.php
index bb5867d..9068794 100644
--- a/ext_tables.php
+++ b/ext_tables.php
@@ -33,12 +33,12 @@ call_user_func(
 		if (TYPO3_MODE === 'BE') {
 			$navigationComponentId = 'TYPO3/CMS/Backend/PageTree/PageTreeElement';
 			\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
-				'Srectorprefix20211231gNews',
+				'SgNews',
 				'web',
 				'News',
 				'',
 				[
-					\SGalinski\Srectorprefix20211231gNews\Controller\BackendController::class => 'index',
+					\SGalinski\SgNews\Controller\BackendController::class => 'index',
 				],
 				[
 					'access' => 'user,group',
-- 
GitLab