diff -u b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php --- b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -25,37 +25,19 @@ * Array of root paths keyed by the corresponding namespace to look for * plugin implementations, \Plugin\$owner\$type will be appended to each * namespace. - * @param array $plugin_namespaces - * An array of paths keyed by it's corresponding namespaces. */ - function __construct($owner, $type, array $root_namespaces = array(), array $plugin_namespaces = array()) { + function __construct($owner, $type, array $root_namespaces = array()) { $this->owner = $owner; $this->type = $type; - $this->rootNamespaces = $root_namespaces; $annotation_namespaces = array( 'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib', 'Drupal\Core\Annotation' => DRUPAL_ROOT . '/core/lib', ); - parent::__construct($plugin_namespaces, $annotation_namespaces, 'Drupal\Core\Annotation\Plugin'); - } - - /** - * Overrides Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery::getPluginNamespaces(). - * - * @todo Figure out how to let this comment still be TRUE. - * This is overridden rather than set in the constructor, because Drupal - * modules can be enabled (and therefore, namespaces registered) during the - * lifetime of a plugin manager. - */ - protected function getPluginNamespaces() { - if (!empty($this->pluginNamespaces)) { - return parent::getPluginNamespaces(); - } $plugin_namespaces = array(); - foreach ($this->rootNamespaces as $namespace => $dir) { + foreach ($root_namespaces as $namespace => $dir) { $plugin_namespaces["$namespace\\Plugin\\{$this->owner}\\{$this->type}"] = array($dir); } - return $plugin_namespaces; + parent::__construct($plugin_namespaces, $annotation_namespaces, 'Drupal\Core\Annotation\Plugin'); } } diff -u b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php @@ -61,16 +61 @@ - /** - * Tests AnnotatedClassDiscovery without root namespaces. - */ - public function testAnnotatedClassDiscoveryWithPluginNamespaces() { - $plugin_namespaces = array(); - $plugin_namespaces['Drupal\\plugin_test\\Plugin\\plugin_test\\fruit'] = array(DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'); - $this->discovery = new AnnotatedClassDiscovery('plugin_test', 'fruit', array(), $plugin_namespaces); - $plugin_namespaces = array(); - $plugin_namespaces['Drupal\\plugin_test\\Plugin\\non_existing_module\\non_existing_plugin_type'] = array(DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'); - $this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module', 'non_existing_plugin_type', array(), $plugin_namespaces); - - $this->testDiscoveryInterface(); - } - } -