diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php index 47ab25b8b1b1befb46d09d461e674c5fe8a6cba5..6695db76db024b4651ae7a10ae9c3de758f8396d 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -69,27 +69,27 @@ public function getDefinitions() { $definitions = parent::getDefinitions(); foreach ($definitions as &$definition) { // Extract the module name from the class namespace if it's not set. - if (!isset($definition['module'])) { - $definition['module'] = $this->getModuleFromNamespace($definition['class']); + if (!isset($definition['provider'])) { + $definition['provider'] = $this->getProviderFromNamespace($definition['class']); } } return $definitions; } /** - * Extracts a module name from a Drupal namespace. + * Extracts the provider name from a Drupal namespace. * * @param string $namespace - * The namespace to extract the module name from. + * The namespace to extract the provider from. * * @return string|null - * The matches module name, or NULL otherwise. + * The matching provider name, or NULL otherwise. */ - protected function getModuleFromNamespace($namespace) { - preg_match('|^Drupal\\\\(?<module>[\w]+)\\\\|', $namespace, $matches); + protected function getProviderFromNamespace($namespace) { + preg_match('|^Drupal\\\\(?<provider>[\w]+)\\\\|', $namespace, $matches); - if (isset($matches['module'])) { - return $matches['module']; + if (isset($matches['provider'])) { + return $matches['provider']; } return NULL; diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php index fb44b292e169c51ed8542102311b299c2e4d2c76..5f8ee2d08964f76de3f327976c74a370cc7e9496 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php @@ -30,7 +30,7 @@ public function setUp() { 'label' => 'Apple', 'color' => 'green', 'class' => 'Drupal\plugin_test\Plugin\plugin_test\fruit\Apple', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), 'banana' => array( 'id' => 'banana', @@ -40,21 +40,21 @@ public function setUp() { 'bread' => t('Banana bread'), ), 'class' => 'Drupal\plugin_test\Plugin\plugin_test\fruit\Banana', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), 'cherry' => array( 'id' => 'cherry', 'label' => 'Cherry', 'color' => 'red', 'class' => 'Drupal\plugin_test\Plugin\plugin_test\fruit\Cherry', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), 'orange' => array( 'id' => 'orange', 'label' => 'Orange', 'color' => 'orange', 'class' => 'Drupal\plugin_test\Plugin\plugin_test\fruit\Orange', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), ); $namespaces = new \ArrayObject(array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib')); diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php index 6b9bdefd326688a4b27587770403599d6095598f..cbf2a16b3742702aabfff79de99b6e38966e0207 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php @@ -32,13 +32,13 @@ protected function setUp() { 'id' => 'example_1', 'custom' => 'John', 'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example1', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), 'example_2' => array( 'id' => 'example_2', 'custom' => 'Paul', 'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example2', - 'module' => 'plugin_test', + 'provider' => 'plugin_test', ), ); $root_namespaces = new \ArrayObject(array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'));