diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index a51320d..35341ce 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -124,21 +124,33 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { protected $containerNeedsDumping; /** - * Holds the list of YAML files containing service definitions. + * List of discovered services.yml pathnames. + * + * This is a nested array whose top-level keys are 'app' and 'site', denoting + * the origin of a service provider. Site-specific providers have to be + * collected separately, because they need to be processed last, so as to be + * able to override services from application service providers. * * @var array */ protected $serviceYamls; /** - * The list of the classnames of the service providers in this kernel. + * List of discovered service provider class names. + * + * This is a nested array whose top-level keys are 'app' and 'site', denoting + * the origin of a service provider. Site-specific providers have to be + * collected separately, because they need to be processed last, so as to be + * able to override services from application service providers. * * @var array */ protected $serviceProviderClasses; /** - * The array of registered service providers. + * List of instantiated service provider classes. + * + * @see \Drupal\Core\DrupalKernel::$serviceProviderClasses * * @var array */ @@ -576,7 +588,10 @@ protected function buildContainer() { */ protected function initializeServiceProviders() { $this->discoverServiceProviders(); - $this->serviceProviders = array(); + $this->serviceProviders = array( + 'app' => array(), + 'site' => array(), + ); foreach ($this->serviceProviderClasses as $origin => $classes) { foreach ($classes as $name => $class) { $this->serviceProviders[$origin][$name] = new $class; diff --git a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelSiteTest.php b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelSiteTest.php index a5d76cb..2384497 100644 --- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelSiteTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelSiteTest.php @@ -14,6 +14,9 @@ */ class DrupalKernelSiteTest extends DrupalUnitTestBase { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'DrupalKernel site service overrides', @@ -25,7 +28,7 @@ public static function getInfo() { /** * Tests services.yml in site directory. */ - function testServicesYml() { + public function testServicesYml() { // A service provider class always has precedence over services.yml files. // The most common swappable core services are overridden by // \Drupal\simpletest\TestServiceProvider already (which proxies into diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index b2ce930..8671ca6 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -49,6 +49,11 @@ * * @see example.sites.php * @see conf_path() + * + * In addition to customizing application settings through variables in + * settings.php, you can create a services.yml file in the same directory to + * register custom, site-specific service definitions and/or swap out default + * implementations with custom ones. */ /**