Issue #2039021 by tim.plunkett, Berdir, Xano | akshay.swnt22: Convert ActionManager to extend DefaultPluginManager.

8.0.x
Nathaniel Catchpole 2014-04-30 11:49:52 +01:00
parent 5c2dc50b20
commit e969642860
2 changed files with 19 additions and 12 deletions

View File

@ -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']

View File

@ -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');
}
/**