protected static function EntityResource::getRequestLink in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::getRequestLink()
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.
2 calls to EntityResource::getRequestLink()
- EntityResource::buildWrappedResponse in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Builds a response with the appropriate wrapped document.
- EntityResource::getPagerLinks in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Get the pager links for a given request object.
File
- core/
modules/ jsonapi/ src/ Controller/ EntityResource.php, line 1246
Class
- EntityResource
- Process all entity requests.
Namespace
Drupal\jsonapi\ControllerCode
protected 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);
}