Skip to content

Commit

Permalink
Merge pull request #7 from slub/fix-redirects
Browse files Browse the repository at this point in the history
fix redirect handling
  • Loading branch information
Alexander Bigga authored Jun 16, 2021
2 parents 5968247 + 70f3918 commit 517e94f
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function initializeAction() {
$this->timing['INIT_START'] = microtime(true) - $this->timing['START'];
}


/**
* Index Action.
*/
Expand Down Expand Up @@ -387,7 +387,7 @@ private function addStandardAssignments () {

/**
* Returns whether extended search should be used or not.
*
*
* @return Boolean
*/
private function isExtendedSearch () {
Expand All @@ -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.
Expand Down Expand Up @@ -617,7 +617,7 @@ private function createQueryForArguments ($arguments) {
return $query;
}



/**
* Adds filter queries for active facets to $query.
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 517e94f

Please sign in to comment.