f8645554b4fc1dd62943f4e4f95ec41e67222975
[yaffs-website] / vendor / drupal / console / templates / module / src / plugin-type-annotation-manager.php.twig
1 {% extends "base/class.php.twig" %}
2
3 {% block file_path %}
4 \Drupal\{{ module }}\Plugin\{{ class_name }}Manager.
5 {% endblock %}
6
7 {% block namespace_class %}
8 namespace Drupal\{{ module }}\Plugin;
9 {% endblock %}
10
11 {% block use_class %}
12 use Drupal\Core\Plugin\DefaultPluginManager;
13 use Drupal\Core\Cache\CacheBackendInterface;
14 use Drupal\Core\Extension\ModuleHandlerInterface;
15 {% endblock %}
16
17 {% block class_declaration %}
18 /**
19  * Provides the {{ label }} plugin manager.
20  */
21 class {{ class_name }}Manager extends DefaultPluginManager {% endblock %}
22 {% block class_methods %}
23
24   /**
25    * Constructor for {{ class_name }}Manager objects.
26    *
27    * @param \Traversable $namespaces
28    *   An object that implements \Traversable which contains the root paths
29    *   keyed by the corresponding namespace to look for plugin implementations.
30    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
31    *   Cache backend instance to use.
32    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
33    *   The module handler to invoke the alter hook with.
34    */
35   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
36     parent::__construct('Plugin/{{ class_name }}', $namespaces, $module_handler, 'Drupal\{{ module }}\Plugin\{{ class_name }}Interface', 'Drupal\{{ module }}\Annotation\{{ class_name }}');
37
38     $this->alterInfo('{{ module }}_{{ machine_name }}_info');
39     $this->setCacheBackend($cache_backend, '{{ module }}_{{ machine_name }}_plugins');
40   }
41 {% endblock %}