function RequestContext::fromRequest

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()

File

core/lib/Drupal/Core/Routing/RequestContext.php, line 34

Class

RequestContext
Holds information about the current request.

Namespace

Drupal\Core\Routing

Code

public function fromRequest(Request $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']);
  }
  return parent::fromRequest($request);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.