Commit e9696428 authored by catch's avatar catch
Browse files

Issue #2039021 by tim.plunkett, Berdir, Xano | akshay.swnt22: Convert...

Issue #2039021 by tim.plunkett, Berdir, Xano | akshay.swnt22: Convert ActionManager to extend DefaultPluginManager.
parent 5c2dc50b
Loading
Loading
Loading
Loading
+1 −1
Changes for core/core.services.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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']
+18 −11
Changes for core/lib/Drupal/Core/Action/ActionManager.php: 18 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -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');
  }

  /**