Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityResource.php

function 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 1264

Class

EntityResource
Process all entity requests.

Namespace

Drupal\jsonapi\Controller

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal