Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\views\Plugin;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Cache\CacheBackendInterface;
|
Chris@0
|
6 use Drupal\Core\Extension\ModuleHandlerInterface;
|
Chris@0
|
7 use Drupal\Core\Plugin\DefaultPluginManager;
|
Chris@0
|
8 use Symfony\Component\DependencyInjection\Container;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Plugin type manager for all views plugins.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @ingroup views_plugins
|
Chris@0
|
14 */
|
Chris@0
|
15 class ViewsPluginManager extends DefaultPluginManager {
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 * Constructs a ViewsPluginManager object.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @param string $type
|
Chris@0
|
21 * The plugin type, for example filter.
|
Chris@0
|
22 * @param \Traversable $namespaces
|
Chris@0
|
23 * An object that implements \Traversable which contains the root paths
|
Chris@0
|
24 * keyed by the corresponding namespace to look for plugin implementations,
|
Chris@0
|
25 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
|
Chris@0
|
26 * Cache backend instance to use.
|
Chris@0
|
27 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
Chris@0
|
28 * The module handler to invoke the alter hook with.
|
Chris@0
|
29 */
|
Chris@0
|
30 public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
|
Chris@0
|
31 $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($type);
|
Chris@0
|
32 parent::__construct("Plugin/views/$type", $namespaces, $module_handler, 'Drupal\views\Plugin\views\ViewsPluginInterface', $plugin_definition_annotation_name);
|
Chris@0
|
33
|
Chris@0
|
34 $this->defaults += [
|
Chris@0
|
35 'parent' => 'parent',
|
Chris@0
|
36 'plugin_type' => $type,
|
Chris@0
|
37 'register_theme' => TRUE,
|
Chris@0
|
38 ];
|
Chris@0
|
39
|
Chris@0
|
40 $this->alterInfo('views_plugins_' . $type);
|
Chris@0
|
41 $this->setCacheBackend($cache_backend, "views:$type");
|
Chris@0
|
42 }
|
Chris@0
|
43
|
Chris@0
|
44 }
|