comparison core/modules/views/src/Plugin/ViewsPluginManager.php @ 0:4c8ae668cc8c

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