public function SavedSearchController::viewSearch in Search API Saved Searches 8
Redirects to the search page for the given saved search.
Parameters
\Drupal\search_api_saved_searches\SavedSearchInterface $search_api_saved_search: The saved search.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse A redirect to the search page.
Throws
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException Thrown if the search didn't specify a search page path.
1 string reference to 'SavedSearchController::viewSearch'
File
- src/
Controller/ SavedSearchController.php, line 28
Class
- SavedSearchController
- Provides routes related to saved searches.
Namespace
Drupal\search_api_saved_searches\ControllerCode
public function viewSearch(SavedSearchInterface $search_api_saved_search) {
$path = $search_api_saved_search
->getPath();
if (!$path) {
throw new NotFoundHttpException();
}
$url = Url::fromUserInput($path, [
'absolute' => TRUE,
]);
return new RedirectResponse($url
->toString(), 302);
}