class RequestContext in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/routing/RequestContext.php \Symfony\Component\Routing\RequestContext
- 8 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/RequestContext.php \Drupal\Core\Routing\RequestContext
Holds information about the current request.
@todo: Remove once the upstream RequestContext provides fromRequestStack(): https://github.com/symfony/symfony/issues/12057
Hierarchy
- class \Symfony\Component\Routing\RequestContext
- class \Drupal\Core\Routing\RequestContext
Expanded class hierarchy of RequestContext
6 files declare their use of RequestContext
- PathBasedBreadcrumbBuilder.php in core/
modules/ system/ src/ PathBasedBreadcrumbBuilder.php - Contains \Drupal\system\PathBasedBreadcrumbBuilder.
- PathFormBase.php in core/
modules/ path/ src/ Form/ PathFormBase.php - Contains \Drupal\path\Form\PathFormBase.
- RedirectResponseSubscriber.php in core/
lib/ Drupal/ Core/ EventSubscriber/ RedirectResponseSubscriber.php - Contains \Drupal\Core\EventSubscriber\RedirectResponseSubscriber.
- SiteInformationForm.php in core/
modules/ system/ src/ Form/ SiteInformationForm.php - Contains \Drupal\system\Form\SiteInformationForm.
- TrustedRedirectResponseTest.php in core/
tests/ Drupal/ Tests/ Core/ Routing/ TrustedRedirectResponseTest.php - Contains \Drupal\Tests\Core\Routing\TrustedRedirectResponseTest.
1 string reference to 'RequestContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses RequestContext
File
- core/
lib/ Drupal/ Core/ Routing/ RequestContext.php, line 20 - Contains \Drupal\Core\Routing\RequestContext.
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) {
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']);
}
}
/**
* 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RequestContext:: |
private | property | ||
RequestContext:: |
protected | property | The scheme, host and base path, for example "http://example.com/d8". | |
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
private | property | ||
RequestContext:: |
public | function |
Updates the RequestContext information based on a HttpFoundation Request. Overrides RequestContext:: |
|
RequestContext:: |
public | function | Populates the context from the current request from the request stack. | |
RequestContext:: |
public | function | Gets the base URL. | |
RequestContext:: |
public | function | Gets the scheme, host and base path. | |
RequestContext:: |
public | function | Gets the HTTP host. | |
RequestContext:: |
public | function | Gets the HTTP port. | |
RequestContext:: |
public | function | Gets the HTTPS port. | |
RequestContext:: |
public | function | Gets the HTTP method. | |
RequestContext:: |
public | function | Gets a parameter value. | |
RequestContext:: |
public | function | Returns the parameters. | |
RequestContext:: |
public | function | Gets the path info. | |
RequestContext:: |
public | function | Gets the query string. | |
RequestContext:: |
public | function | Gets the HTTP scheme. | |
RequestContext:: |
public | function | Checks if a parameter value is set for the given parameter. | |
RequestContext:: |
public | function | Sets the base URL. | |
RequestContext:: |
public | function | Sets the complete base URL for the Request context. | |
RequestContext:: |
public | function | Sets the HTTP host. | |
RequestContext:: |
public | function | Sets the HTTP port. | |
RequestContext:: |
public | function | Sets the HTTPS port. | |
RequestContext:: |
public | function | Sets the HTTP method. | |
RequestContext:: |
public | function | Sets a parameter value. | |
RequestContext:: |
public | function | Sets the parameters. | |
RequestContext:: |
public | function | Sets the path info. | |
RequestContext:: |
public | function | Sets the query string. | |
RequestContext:: |
public | function | Sets the HTTP scheme. | |
RequestContext:: |
public | function | Constructor. |