You are here

public function Extension::__wakeup in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Extension/Extension.php \Drupal\Core\Extension\Extension::__wakeup()

Magic method implementation to unserialize the extension object.

File

core/lib/Drupal/Core/Extension/Extension.php, line 184

Class

Extension
Defines an extension (file) object.

Namespace

Drupal\Core\Extension

Code

public function __wakeup() {

  // Get the app root from the container. While compiling the container we
  // have to discover all the extension service files in
  // \Drupal\Core\DrupalKernel::initializeServiceProviders(). This results in
  // creating extension objects before the container has the kernel.
  // Specifically, this occurs during the call to
  // \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory().
  $container = \Drupal::hasContainer() ? \Drupal::getContainer() : FALSE;
  $this->root = $container && $container
    ->hasParameter('app.root') ? $container
    ->getParameter('app.root') : DRUPAL_ROOT;
}