diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 729ff78..9f6da98 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -371,8 +371,16 @@ protected function buildContainer() { // Get a list of namespaces and put it onto the container. $namespaces = $this->getModuleNamespaces($this->getModuleFileNames()); - $namespaces['Drupal\Core'] = DRUPAL_ROOT . '/core/lib'; - $namespaces['Drupal\Component'] = DRUPAL_ROOT . '/core/lib'; + // Add all components in \Drupal\Core and \Drupal\Component that have a + // Plugin directory. + foreach (array('Core', 'Component') as $parent_directory) { + $path = DRUPAL_ROOT . '/core/lib/Drupal/' . $parent_directory; + foreach (new \DirectoryIterator($path) as $component) { + if (!$component->isDot() && is_dir($component->getPathname() . '/Plugin')) { + $namespaces['Drupal\Core\\' . $component->getFilename()] = DRUPAL_ROOT . '/core/lib'; + } + } + } $container->setParameter('container.namespaces', $namespaces); // Register synthetic services. diff --git a/core/lib/Drupal/Core/Validation/ConstraintManager.php b/core/lib/Drupal/Core/Validation/ConstraintManager.php index 3f55ae8..e0444ae 100644 --- a/core/lib/Drupal/Core/Validation/ConstraintManager.php +++ b/core/lib/Drupal/Core/Validation/ConstraintManager.php @@ -43,8 +43,6 @@ class ConstraintManager extends PluginManagerBase { * An array of paths keyed by it's corresponding namespaces. */ public function __construct(array $namespaces) { - // Allow the component to provide plugins. - $namespaces['Drupal\Core\Validation'] = DRUPAL_ROOT . '/core/lib'; $this->discovery = new AnnotatedClassDiscovery('Validation', 'Constraint', $namespaces); $this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions')); $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);