function InstallerKernel::initializeContainer
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Installer/InstallerKernel.php \Drupal\Core\Installer\InstallerKernel::initializeContainer()
- 10 core/lib/Drupal/Core/Installer/InstallerKernel.php \Drupal\Core\Installer\InstallerKernel::initializeContainer()
- 9 core/lib/Drupal/Core/Installer/InstallerKernel.php \Drupal\Core\Installer\InstallerKernel::initializeContainer()
- 8.9.x core/lib/Drupal/Core/Installer/InstallerKernel.php \Drupal\Core\Installer\InstallerKernel::initializeContainer()
Initializes the service container.
Return value
\Symfony\Component\DependencyInjection\ContainerInterface An initialized container object.
Overrides DrupalKernel::initializeContainer
File
-
core/
lib/ Drupal/ Core/ Installer/ InstallerKernel.php, line 24
Class
- InstallerKernel
- Extend DrupalKernel to handle force some kernel behaviors.
Namespace
Drupal\Core\InstallerCode
protected function initializeContainer() {
// Ensure the InstallerKernel's container is not dumped.
$this->allowDumping = FALSE;
// During installation, initializeContainer() can be called multiple times
// without any module changes in between. Since allowDumping is FALSE, no
// cached container exists, so the parent will always recompile.
$extensions = $this->getExtensions();
if (isset($this->container) && count($extensions['module'] ?? []) === count($this->compiledExtensions['module'] ?? []) && count($extensions['theme'] ?? []) === count($this->compiledExtensions['theme'] ?? []) && !array_diff_key($extensions['module'] ?? [], $this->compiledExtensions['module'] ?? []) && !array_diff_key($extensions['theme'] ?? [], $this->compiledExtensions['theme'] ?? [])) {
$this->containerNeedsRebuild = FALSE;
return $this->container;
}
else {
$this->containerNeedsRebuild = TRUE;
$this->compiledExtensions = $extensions;
return parent::initializeContainer();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.