diff --git a/core/modules/entity_reference/entity_reference.services.yml b/core/modules/entity_reference/entity_reference.services.yml index 02c3106..91842ca 100644 --- a/core/modules/entity_reference/entity_reference.services.yml +++ b/core/modules/entity_reference/entity_reference.services.yml @@ -1,7 +1,7 @@ services: plugin.manager.entity_reference.selection: class: Drupal\entity_reference\Plugin\Type\SelectionPluginManager - arguments: ['@container.namespaces'] + arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] entity_reference.autocomplete: class: Drupal\entity_reference\EntityReferenceAutocomplete arguments: ['@plugin.manager.entity'] diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php index 5fcee09..b8db47b 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php @@ -9,29 +9,28 @@ use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Component\Plugin\Factory\ReflectionFactory; -use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Core\Plugin\Discovery\AlterDecorator; -use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; -use Drupal\Core\Plugin\Discovery\CacheDecorator; +use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Language\LanguageManager; +use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken; /** * Plugin type manager for the Entity Reference Selection plugin. */ -class SelectionPluginManager extends PluginManagerBase { +class SelectionPluginManager extends DefaultPluginManager { /** - * Constructs a SelectionPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations, + * {@inheritdoc} */ - public function __construct(\Traversable $namespaces) { - $annotation_namespaces = array('Drupal\entity_reference\Annotation' => $namespaces['Drupal\entity_reference']); - $this->discovery = new AnnotatedClassDiscovery('entity_reference/selection', $namespaces, $annotation_namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection'); - $this->discovery = new AlterDecorator($this->discovery, 'entity_reference_selection'); - $this->discovery = new CacheDecorator($this->discovery, 'entity_reference_selection'); + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + $this->alterInfo($module_handler, 'entity_reference_selection'); + $this->setCacheBackend($cache_backend, $language_manager, 'entity_reference_selection'); + + $annotation_namespaces = array( + 'Drupal\entity_reference\Annotation' => $namespaces['Drupal\entity_reference'] + ); + parent::__construct('entity_reference/selection', $namespaces, $annotation_namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection'); $this->factory = new ReflectionFactory($this); }