public function PanopolySearchController::redirectToSearch in Panopoly 8.2
Controller to redirect to the search page.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
Return value
array|\Symfony\Component\HttpFoundation\RedirectResponse The response.
1 string reference to 'PanopolySearchController::redirectToSearch'
- panopoly_search.routing.yml in modules/
panopoly/ panopoly_search/ panopoly_search.routing.yml - modules/panopoly/panopoly_search/panopoly_search.routing.yml
File
- modules/
panopoly/ panopoly_search/ src/ Controller/ PanopolySearchController.php, line 23
Class
- PanopolySearchController
- Panopoly Search controller.
Namespace
Drupal\panopoly_search\ControllerCode
public function redirectToSearch(Request $request) {
$search_page_route = panopoly_search_page_route();
if (empty($search_page_route)) {
$build = [
'#markup' => t('Search is currently disabled'),
];
return $build;
}
$parameters = [];
if ($keys = $request
->get('keys')) {
$parameters['keys'] = $keys;
}
return new RedirectResponse(Url::fromRoute($search_page_route, $parameters, [
'absolute' => TRUE,
])
->toString());
}