From 70f39188bcb22859ba9e07938cf13c9c8ee8fcf3 Mon Sep 17 00:00:00 2001 From: Norman Steger Date: Wed, 16 Jun 2021 10:26:54 +0200 Subject: [PATCH] fix redirect handling --- Classes/Controller/SearchController.php | 53 ++++++++++++------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/Classes/Controller/SearchController.php b/Classes/Controller/SearchController.php index a44255e0..956b3c5c 100644 --- a/Classes/Controller/SearchController.php +++ b/Classes/Controller/SearchController.php @@ -106,7 +106,7 @@ public function initializeAction() { $this->timing['INIT_START'] = microtime(true) - $this->timing['START']; } - + /** * Index Action. */ @@ -387,7 +387,7 @@ private function addStandardAssignments () { /** * Returns whether extended search should be used or not. - * + * * @return Boolean */ private function isExtendedSearch () { @@ -410,11 +410,11 @@ private function isExtendedSearch () { } } } - + return $result; } - + /** * Takes the array of search query parameters and builds an array of Solr * search strings from it, using the »queryFields« configuration from TypoScript. @@ -617,7 +617,7 @@ private function createQueryForArguments ($arguments) { return $query; } - + /** * Adds filter queries for active facets to $query. @@ -1471,32 +1471,31 @@ public function redirectAction() { $resultSet = $selectResults->getDocuments(); - $arguments = array( - array('tx_find_find' => - array( - 'id' => $resultSet[0]['id'], - ) - ) - ); - - $uri = $this->uriBuilder->reset()->setTargetPageUid(intval($GLOBALS['TSFE']->id))->setCreateAbsoluteUri(TRUE)->setArguments($arguments)->build(); + $arguments = [ + 'tx_find_find' => [ + 'action' => 'detail', + 'controller' => 'Search', + 'id' => $resultSet[0]['id'] + ] + ]; - \TYPO3\CMS\Core\Utility\HttpUtility ::redirect($uri); + $uri = $this->uriBuilder->reset()->setTargetPageUid(intval($GLOBALS['TSFE']->id))->setCreateAbsoluteUri(true)->setArguments($arguments)->build(); + \TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri); } else { - $arguments = array( - array('tx_find_find' => - array( - 'q' => array( - 'default' => $queryArgumentsDefault - ), - ) - ) - ); - - $uri = $this->uriBuilder->reset()->setTargetPageUid(intval($GLOBALS['TSFE']->id))->setCreateAbsoluteUri(TRUE)->setUseCacheHash(FALSE)->setArguments($arguments)->build(); - \TYPO3\CMS\Core\Utility\HttpUtility ::redirect($uri); + $arguments = [ + 'tx_find_find' => [ + 'action' => 'index', + 'controller' => 'Search', + 'q' => [ + 'default' => $queryArgumentsDefault + ] + ] + ]; + + $uri = $this->uriBuilder->reset()->setTargetPageUid(intval($GLOBALS['TSFE']->id))->setCreateAbsoluteUri(true)->setUseCacheHash(false)->setArguments($arguments)->build(); + \TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri); } die();