diff --git a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php deleted file mode 100644 index 09f5255c4bc..00000000000 --- a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php +++ /dev/null @@ -1,50 +0,0 @@ -type = $type; - parent::__construct("Plugin/views/$type", $root_namespaces, 'Drupal\Component\Annotation\PluginID'); - } - - /** - * {@inheritdoc} - */ - public function getDefinitions() { - // Add the plugin_type to the definition. - $definitions = parent::getDefinitions(); - foreach ($definitions as $key => $definition) { - $definitions[$key]['plugin_type'] = $this->type; - } - return $definitions; - } - -} diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php index 0a1fb76bdba..2fc32525477 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php @@ -8,16 +8,16 @@ namespace Drupal\views\Plugin; use Drupal\Component\Plugin\Exception\PluginException; -use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Core\Plugin\Factory\ContainerFactory; -use Drupal\Core\Plugin\Discovery\CacheDecorator; -use Drupal\views\Plugin\Discovery\ViewsHandlerDiscovery; +use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Language\LanguageManagerInterface; +use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\views\ViewsData; /** * Plugin type manager for all views handlers. */ -class ViewsHandlerManager extends PluginManagerBase { +class ViewsHandlerManager extends DefaultPluginManager { /** * The views data cache. @@ -45,18 +45,25 @@ class ViewsHandlerManager extends PluginManagerBase { * keyed by the corresponding namespace to look for plugin implementations, * @param \Drupal\views\ViewsData $views_data * The views data cache. + * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend + * Cache backend instance to use. + * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager + * The language manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler to invoke the alter hook with. */ - public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data) { - $this->discovery = new ViewsHandlerDiscovery($handler_type, $namespaces); - $this->discovery = new CacheDecorator($this->discovery, "views:$handler_type", 'views_info'); + public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) { + parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, 'Drupal\Component\Annotation\PluginID'); - $this->factory = new ContainerFactory($this); + $this->setCacheBackend($cache_backend, $language_manager, "views:$handler_type"); $this->viewsData = $views_data; $this->handlerType = $handler_type; + $this->defaults = array( + 'plugin_type' => $handler_type, + ); } - /** * Fetches a handler from the data cache. * diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 30aa96af8c3..f42a7bd3d73 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -4,10 +4,10 @@ services: arguments: [access, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.area: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [area, '@container.namespaces', '@views.views_data'] + arguments: [area, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.argument: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [argument, '@container.namespaces', '@views.views_data'] + arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.argument_default: class: Drupal\views\Plugin\ViewsPluginManager arguments: [argument_default, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] @@ -28,13 +28,13 @@ services: arguments: [exposed_form, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.field: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [field, '@container.namespaces', '@views.views_data'] + arguments: [field, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.filter: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [filter, '@container.namespaces', '@views.views_data'] + arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.join: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [join, '@container.namespaces', '@views.views_data'] + arguments: [join, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.pager: class: Drupal\views\Plugin\ViewsPluginManager arguments: [pager, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] @@ -43,13 +43,13 @@ services: arguments: [query, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.relationship: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [relationship, '@container.namespaces', '@views.views_data'] + arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.row: class: Drupal\views\Plugin\ViewsPluginManager arguments: [row, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.sort: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [sort, '@container.namespaces', '@views.views_data'] + arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.views_info', '@language_manager', '@module_handler'] plugin.manager.views.style: class: Drupal\views\Plugin\ViewsPluginManager arguments: [style, '@container.namespaces', '@cache.views_info', '@language_manager', '@module_handler']