public static function IndexResource::getRequestLink in JSON:API Search API 8
Get the full URL for a given request object.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
array|null $query: The query parameters to use. Leave it empty to get the query from the request object.
Return value
\Drupal\Core\Url The full URL.
1 call to IndexResource::getRequestLink()
- IndexResource::getPagerLinks in src/
Resource/ IndexResource.php - Get pager links.
File
- src/
Resource/ IndexResource.php, line 315
Class
- IndexResource
- JSON:API Resource to return Search API index results.
Namespace
Drupal\jsonapi_search_api\ResourceCode
public static function getRequestLink(Request $request, $query = NULL) {
if ($query === NULL) {
return Url::fromUri($request
->getUri());
}
$uri_without_query_string = $request
->getSchemeAndHttpHost() . $request
->getBaseUrl() . $request
->getPathInfo();
return Url::fromUri($uri_without_query_string)
->setOption('query', $query);
}