Skip to content

Instantly share code, notes, and snippets.

@damiankloip
Created November 21, 2013 17:44
Show Gist options
  • Save damiankloip/7586174 to your computer and use it in GitHub Desktop.
Save damiankloip/7586174 to your computer and use it in GitHub Desktop.
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 8d6e28c..db55db8 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -7,9 +7,9 @@
namespace Drupal\Core;
+use Drupal\Component\Utility\Settings;
use Drupal\Component\PhpStorage\PhpStorageFactory;
use Drupal\Core\Config\BootstrapConfigStorageFactory;
-use Drupal\Core\CoreServiceProvider;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderInterface;
use Drupal\Core\DependencyInjection\YamlFileLoader;
@@ -200,6 +200,15 @@ public function getContainer() {
}
/**
+ * Gets the settings instance.
+ *
+ * @return \Drupal\Component\Utility\Settings
+ */
+ protected function settings() {
+ return Settings::getSingleton();
+ }
+
+ /**
* {@inheritdoc}
*/
public function discoverServiceProviders() {
@@ -221,6 +230,11 @@ public function discoverServiceProviders() {
$module_filenames = $this->getModuleFileNames();
$this->registerNamespaces($this->getModuleNamespaces($module_filenames));
+ // Add site specific or test namespaces.
+ if ($autoload_namespaces = $this->settings()->get('autoload_namespaces', array())) {
+ $this->registerNamespaces($autoload_namespaces);
+ }
+
// Load each module's serviceProvider class.
foreach ($this->moduleList as $module => $weight) {
$camelized = ContainerBuilder::camelize($module);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment