diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 9b08432..8173c68 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -22,7 +22,7 @@ /** * Base class for plugin managers. */ -abstract class DefaultPluginManager extends PluginManagerBase implements PluginManagerInterface, CachedDiscoveryInterface { +class DefaultPluginManager extends PluginManagerBase implements PluginManagerInterface, CachedDiscoveryInterface { /** * Cached definitions array. @@ -106,13 +106,13 @@ public function __construct($subdir, \Traversable $namespaces, $annotation_names * Initialize the cache backend. * * Plugin definitions are cached using the provided cache backend. The - * interface languge is added as a suffix to the cache key. + * interface language is added as a suffix to the cache key. * * @param \Drupal\Core\Cache\CacheBackendInterface $cache * Cache backend instance to use. * @param \Drupal\Core\Language\LanguageManager * The language manager. - * @param type $cache_key_prefix + * @param string $cache_key_prefix * Cache key prefix to use, the language code will be appended * automatically. */ @@ -126,7 +126,7 @@ public function setCache(CacheBackendInterface $cache, LanguageManager $language /** * Initializes the alter hook. * - * @param \Drupal\Core\Extension\ModuleHandler $module_handler + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. * @param string $alter_hook * Name of the alter hook. @@ -148,6 +148,7 @@ public function getDefinition($plugin_id) { if (isset($this->definitions[$plugin_id])) { return $this->definitions[$plugin_id]; } + return array(); } /** diff --git a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php index 746adcf..b7fe091 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php +++ b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php @@ -21,13 +21,15 @@ class TestPluginManager extends DefaultPluginManager { * * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations, - * @param \Drupal\Core\Extension\ModuleHandler $module_handler + * keyed by the corresponding namespace to look for plugin implementations. + * @param array $definitions + * An array of static definitions. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * (optional) The module handler to invoke the alter hook with. * @param string $alter_hook * (optional) Name of the alter hook. */ - public function __construct(\Traversable $namespaces, $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL) { + public function __construct(\Traversable $namespaces, array $definitions, ModuleHandlerInterface $module_handler = NULL, $alter_hook = NULL) { // Create the object that can be used to return definitions for all the // plugins available for this type. Most real plugin managers use a richer // discovery implementation, but StaticDiscovery lets us add some simple