class RequestContext
Same name in this branch
- 11.1.x vendor/symfony/routing/RequestContext.php \Symfony\Component\Routing\RequestContext
Holds information about the current request.
Hierarchy
- class \Symfony\Component\Routing\RequestContext
- class \Drupal\Core\Routing\RequestContext extends \Symfony\Component\Routing\RequestContext
Expanded class hierarchy of RequestContext
6 files declare their use of RequestContext
- BigPipe.php in core/
modules/ big_pipe/ src/ Render/ BigPipe.php - IFrameUrlHelper.php in core/
modules/ media/ src/ IFrameUrlHelper.php - PathBasedBreadcrumbBuilder.php in core/
modules/ system/ src/ PathBasedBreadcrumbBuilder.php - PathValidator.php in core/
lib/ Drupal/ Core/ Path/ PathValidator.php - RedirectResponseSubscriber.php in core/
lib/ Drupal/ Core/ EventSubscriber/ RedirectResponseSubscriber.php
File
-
core/
lib/ Drupal/ Core/ Routing/ RequestContext.php, line 12
Namespace
Drupal\Core\RoutingView source
class RequestContext extends SymfonyRequestContext {
/**
* The scheme, host and base path, for example "http://example.com/d8".
*
* @var string
*/
protected $completeBaseUrl;
/**
* Populates the context from the current request from the request stack.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The current request stack.
*/
public function fromRequestStack(RequestStack $request_stack) {
$this->fromRequest($request_stack->getCurrentRequest());
}
/**
* {@inheritdoc}
*/
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);
}
/**
* Gets the scheme, host and base path.
*
* For example, in an installation in a subdirectory "d8", it should be
* "https://example.com/d8".
*/
public function getCompleteBaseUrl() {
return $this->completeBaseUrl;
}
/**
* Sets the complete base URL for the Request context.
*
* @param string $complete_base_url
* The complete base URL.
*/
public function setCompleteBaseUrl($complete_base_url) {
$this->completeBaseUrl = $complete_base_url;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
RequestContext::$baseUrl | private | property | ||
RequestContext::$completeBaseUrl | protected | property | The scheme, host and base path, for example "http://example.com/d8". | |
RequestContext::$host | private | property | ||
RequestContext::$httpPort | private | property | ||
RequestContext::$httpsPort | private | property | ||
RequestContext::$method | private | property | ||
RequestContext::$parameters | private | property | ||
RequestContext::$pathInfo | private | property | ||
RequestContext::$queryString | private | property | ||
RequestContext::$scheme | private | property | ||
RequestContext::fromRequest | public | function | Updates the RequestContext information based on a HttpFoundation Request. | Overrides RequestContext::fromRequest |
RequestContext::fromRequestStack | public | function | Populates the context from the current request from the request stack. | |
RequestContext::fromUri | public static | function | ||
RequestContext::getBaseUrl | public | function | Gets the base URL. | |
RequestContext::getCompleteBaseUrl | public | function | Gets the scheme, host and base path. | |
RequestContext::getHost | public | function | Gets the HTTP host. | |
RequestContext::getHttpPort | public | function | Gets the HTTP port. | |
RequestContext::getHttpsPort | public | function | Gets the HTTPS port. | |
RequestContext::getMethod | public | function | Gets the HTTP method. | |
RequestContext::getParameter | public | function | Gets a parameter value. | |
RequestContext::getParameters | public | function | Returns the parameters. | |
RequestContext::getPathInfo | public | function | Gets the path info. | |
RequestContext::getQueryString | public | function | Gets the query string without the "?". | |
RequestContext::getScheme | public | function | Gets the HTTP scheme. | |
RequestContext::hasParameter | public | function | Checks if a parameter value is set for the given parameter. | |
RequestContext::isSecure | public | function | ||
RequestContext::setBaseUrl | public | function | Sets the base URL. | |
RequestContext::setCompleteBaseUrl | public | function | Sets the complete base URL for the Request context. | |
RequestContext::setHost | public | function | Sets the HTTP host. | |
RequestContext::setHttpPort | public | function | Sets the HTTP port. | |
RequestContext::setHttpsPort | public | function | Sets the HTTPS port. | |
RequestContext::setMethod | public | function | Sets the HTTP method. | |
RequestContext::setParameter | public | function | Sets a parameter value. | |
RequestContext::setParameters | public | function | Sets the parameters. | |
RequestContext::setPathInfo | public | function | Sets the path info. | |
RequestContext::setQueryString | public | function | Sets the query string. | |
RequestContext::setScheme | public | function | Sets the HTTP scheme. | |
RequestContext::__construct | public | function |