public function LinkManager::getRequestLink in JSON: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
string The full URL.
1 call to LinkManager::getRequestLink()
- LinkManager::getPagerLinks in src/
LinkManager/ LinkManager.php - Get the pager links for a given request object.
File
- src/
LinkManager/ LinkManager.php, line 81
Class
- LinkManager
- Class to generate links and queries for entities.
Namespace
Drupal\jsonapi\LinkManagerCode
public function getRequestLink(Request $request, $query = NULL) {
if ($query === NULL) {
return $request
->getUri();
}
$uri_without_query_string = $request
->getSchemeAndHttpHost() . $request
->getBaseUrl() . $request
->getPathInfo();
return Url::fromUri($uri_without_query_string)
->setOption('query', $query)
->toString();
}