W3cubDocs

/Drupal 8

public static function DrupalKernel::createFromRequest

public static DrupalKernel::createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE)

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; e.g., \Symfony\Component\ClassLoader\ApcClassLoader.

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.

Return value

static

Throws

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

File

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

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) {
  $kernel = new static($environment, $class_loader, $allow_dumping);
  static::bootEnvironment();
  $kernel->initializeSettings($request);
  return $kernel;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::createFromRequest/8.1.x