You are here

public function RequestContext::fromRequest in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/routing/RequestContext.php \Symfony\Component\Routing\RequestContext::fromRequest()
  2. 8 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()

Updates the RequestContext information based on a HttpFoundation Request.

Parameters

Request $request A Request instance:

Return value

RequestContext The current instance, implementing a fluent interface

Overrides RequestContext::fromRequest

1 call to RequestContext::fromRequest()
RequestContext::fromRequestStack in core/lib/Drupal/Core/Routing/RequestContext.php
Populates the context from the current request from the request stack.

File

core/lib/Drupal/Core/Routing/RequestContext.php, line 42
Contains \Drupal\Core\Routing\RequestContext.

Class

RequestContext
Holds information about the current request.

Namespace

Drupal\Core\Routing

Code

public function fromRequest(Request $request) {
  parent::fromRequest($request);

  // @todo Extract the code in DrupalKernel::initializeRequestGlobals.
  //   See https://www.drupal.org/node/2404601
  if (isset($GLOBALS['base_url'])) {
    $this
      ->setCompleteBaseUrl($GLOBALS['base_url']);
  }
}