function RequestContext::fromRequestStack

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequestStack()
  2. 10 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequestStack()
  3. 11.x core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext::fromRequestStack()

Populates the context from the current request from the request stack.

Parameters

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The current request stack.

File

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

Class

RequestContext
Holds information about the current request.

Namespace

Drupal\Core\Routing

Code

public function fromRequestStack(RequestStack $request_stack) {
    $this->fromRequest($request_stack->getCurrentRequest());
}

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