diff --git a/Classes/Middleware/RedirectionMiddleware.php b/Classes/Middleware/RedirectionMiddleware.php index 7662bda..a2c15e0 100644 --- a/Classes/Middleware/RedirectionMiddleware.php +++ b/Classes/Middleware/RedirectionMiddleware.php @@ -44,6 +44,17 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface */ $cookieName = 'site-language-preference'; + // stop if somewhere in our rootline tx_sitelanguageredirection_stop has been set + $pageArguments = $request->getAttribute('routing'); + $rootlineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pageArguments->getPageId()); + /** @var RootlineUtility $rootlineUtility */ + $pageRootline = $rootlineUtility->get(); + foreach ($pageRootline as $pageItem) { + if (isset($pageItem['tx_sitelanguageredirection_stop']) && $pageItem['tx_sitelanguageredirection_stop'] === 1) { + return $handler->handle($request); + } + } + /** * Do not redirect search engine bots. */ diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php new file mode 100644 index 0000000..6a3904c --- /dev/null +++ b/Configuration/TCA/Overrides/pages.php @@ -0,0 +1,53 @@ + [ + 'exclude' => 1, + 'l10n_mode' => 'exclude', + 'label' => 'LLL:EXT:site_language_redirection/Resources/Private/Language/locallang_db.xlf:pages.tx_sitelanguageredirection_stop.label', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + ] + ], + ] + ], + ] +); + +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( + 'pages', + 'tx_sitelanguageredirection_stop', + 1, + 'after:php_tree_stop' +); diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf new file mode 100644 index 0000000..1e25318 --- /dev/null +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -0,0 +1,18 @@ + + + +
+ database + Language labels for database tables/fields belonging to extension 'site-language-redirection' + LFEditor + Matthia Adrowski + matthias.adrowski@sgalinski.de +
+ + + Stop Site Language Redirects + Stop Site Language Redirects + + +
+
diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf new file mode 100644 index 0000000..efd5675 --- /dev/null +++ b/Resources/Private/Language/locallang_db.xlf @@ -0,0 +1,17 @@ + + + +
+ database + Language labels for database tables/fields belonging to extension 'site-language-redirection' + LFEditor + Matthia Adrowski + matthias.adrowski@sgalinski.de +
+ + + Stop Site Language Redirects + + +
+
diff --git a/ext_localconf.php b/ext_localconf.php new file mode 100644 index 0000000..4739de2 --- /dev/null +++ b/ext_localconf.php @@ -0,0 +1,7 @@ +