From a3a908edded0195f2bc232b40610009e588aaea4 Mon Sep 17 00:00:00 2001 From: Matthias Adrowski <matthias.adrowski@sgalinski.de> Date: Mon, 10 Jan 2022 15:56:56 +0100 Subject: [PATCH] [TASK] Migrate OverviewController --- Classes/Controller/OverviewController.php | 34 +++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/Classes/Controller/OverviewController.php b/Classes/Controller/OverviewController.php index 9edb1e0..140ee2f 100644 --- a/Classes/Controller/OverviewController.php +++ b/Classes/Controller/OverviewController.php @@ -101,13 +101,12 @@ class OverviewController extends AbstractController { * * @param array $newsFilter * @param int $currentPageBrowserPage - * @return void * @throws \InvalidArgumentException * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException * @throws \TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException */ - public function overviewAction(array $newsFilter = [], int $currentPageBrowserPage = 0) { + public function overviewAction(array $newsFilter = [], int $currentPageBrowserPage = 0): ?\Psr\Http\Message\ResponseInterface { switch ((int) $this->settings['groupBy']) { case 1: $this->overviewWithCategories([], [], $newsFilter, $currentPageBrowserPage); @@ -116,9 +115,23 @@ class OverviewController extends AbstractController { $this->overviewWithTags([], [], $newsFilter, $currentPageBrowserPage); break; default: - $this->forward('overviewWithoutCategories', NULL, NULL, $this->request->getArguments()); + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + $this->forward('overviewWithoutCategories', NULL, NULL, $this->request->getArguments()); + } + else { + return (new \TYPO3\CMS\Extbase\Http\ForwardResponse('overviewWithoutCategories')->withControllerName('Record') + ->withExtensionName('Extension') + ->withArguments( $this->request->getArguments()); + } break; } + + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } /** @@ -533,7 +546,7 @@ class OverviewController extends AbstractController { */ protected function overviewWithoutCategoriesAction( array $newsMetaData = [], array $newsFilter = NULL, int $currentPageBrowserPage = 0 - ) { + ): ?\Psr\Http\Message\ResponseInterface { // remember selection of the filter values, if any $selectedTag = $this->tagRepository->findByUid((int) $newsFilter['tag']); $selectedCategory = $this->categoryRepository->findByUid((int) $newsFilter['category']); @@ -594,7 +607,12 @@ class OverviewController extends AbstractController { } if ($newsCount <= 0) { - return; + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } // filter by category and tag if selected in the filter @@ -641,6 +659,12 @@ class OverviewController extends AbstractController { $this->view->assign('categories', $categories); $this->view->assign('numberOfPages', $numberOfPages); $this->view->assign('newsMetaData', $newsMetaData); + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } /** -- GitLab