function DrupalKernel::createFromRequest

Same name in other branches
  1. 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::createFromRequest()
  2. 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::createFromRequest()
  3. 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::createFromRequest()

Create a DrupalKernel object from a request.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

$class_loader: The class loader. Normally Composer's ClassLoader, as included by the front controller, but may also be decorated.

string $environment: String indicating the environment, e.g. 'prod' or 'dev'.

bool $allow_dumping: (optional) FALSE to stop the container from being written to or read from disk. Defaults to TRUE.

string $app_root: (optional) The path to the application root as a string. If not supplied, the application root will be computed.

Return value

static

Throws

\Symfony\Component\HttpKernel\Exception\BadRequestHttpException In case the host name in the request is not trusted.

7 calls to DrupalKernel::createFromRequest()
authorize.php in core/authorize.php
Administrative script for running authorized file operations.
DrupalKernelTest::getTestKernel in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
Build a kernel for testings.
DrupalKernelTest::testRepeatedBootWithDifferentEnvironment in core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
Tests repeated loading of compiled DIC with different environment.
FunctionalTestSetupTrait::initKernel in core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
Initializes the kernel after installation.
InstallerTestBase::setUp in core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php

... See full list

1 method overrides DrupalKernel::createFromRequest()
TestRunnerKernel::createFromRequest in core/lib/Drupal/Core/Test/TestRunnerKernel.php
Create a DrupalKernel object from a request.

File

core/lib/Drupal/Core/DrupalKernel.php, line 298

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE, $app_root = NULL) {
    $kernel = new static($environment, $class_loader, $allow_dumping, $app_root);
    static::bootEnvironment($app_root);
    $kernel->initializeSettings($request);
    return $kernel;
}

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