function DrupalKernel::initializeServiceProviders
Same name in other branches
- 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeServiceProviders()
- 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeServiceProviders()
- 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeServiceProviders()
Registers all service providers to the kernel.
Throws
\LogicException
1 call to DrupalKernel::initializeServiceProviders()
- DrupalKernel::compileContainer in core/
lib/ Drupal/ Core/ DrupalKernel.php - Compiles a new service container.
File
-
core/
lib/ Drupal/ Core/ DrupalKernel.php, line 1344
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
protected function initializeServiceProviders() {
$this->discoverServiceProviders();
$this->serviceProviders = [
'app' => [],
'site' => [],
];
foreach ($this->serviceProviderClasses as $origin => $classes) {
foreach ($classes as $name => $class) {
if (!is_object($class)) {
$this->serviceProviders[$origin][$name] = new $class();
}
else {
$this->serviceProviders[$origin][$name] = $class;
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.