From e96964286085e91e0c152ec6cb2fcbef4965459d Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Wed, 30 Apr 2014 11:49:52 +0100 Subject: [PATCH] Issue #2039021 by tim.plunkett, Berdir, Xano | akshay.swnt22: Convert ActionManager to extend DefaultPluginManager. --- core/core.services.yml | 2 +- core/lib/Drupal/Core/Action/ActionManager.php | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/core.services.yml b/core/core.services.yml index dd262192069..19b0b72ee66 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -234,7 +234,7 @@ services: parent: default_plugin_manager plugin.manager.action: class: Drupal\Core\Action\ActionManager - arguments: ['@container.namespaces'] + arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] plugin.manager.menu.local_action: class: Drupal\Core\Menu\LocalActionManager arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user'] diff --git a/core/lib/Drupal/Core/Action/ActionManager.php b/core/lib/Drupal/Core/Action/ActionManager.php index 4d9b232d089..fbd824e399b 100644 --- a/core/lib/Drupal/Core/Action/ActionManager.php +++ b/core/lib/Drupal/Core/Action/ActionManager.php @@ -7,31 +7,38 @@ namespace Drupal\Core\Action; -use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Language\LanguageManager; +use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Plugin\Discovery\AlterDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; -use Drupal\Core\Plugin\Factory\ContainerFactory; /** * Provides an Action plugin manager. * - * @see \Drupal\Core\Annotation\Operation - * @see \Drupal\Core\Action\OperationInterface + * @see \Drupal\Core\Annotation\Action + * @see \Drupal\Core\Action\ActionInterface */ -class ActionManager extends PluginManagerBase { +class ActionManager extends DefaultPluginManager { /** - * Constructs a ActionManager object. + * Constructs a new class instance. * * @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\Cache\CacheBackendInterface $cache_backend + * Cache backend instance to use. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The language manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces) { - $this->discovery = new AnnotatedClassDiscovery('Plugin/Action', $namespaces, 'Drupal\Core\Annotation\Action'); - $this->discovery = new AlterDecorator($this->discovery, 'action_info'); - - $this->factory = new ContainerFactory($this); + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + parent::__construct('Plugin/Action', $namespaces, $module_handler, 'Drupal\Core\Annotation\Action'); + $this->alterInfo('action_info'); + $this->setCacheBackend($cache_backend, $language_manager, 'action_info'); } /**