function RequestContext::fromRequest

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()
  2. 8.9.x core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequest()
  3. 10 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\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 34

Class

RequestContext
Holds information about the current request.

Namespace

Drupal\Core\Routing

Code

public function fromRequest(Request $request) : static {
    // @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.