Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / aggregator / src / Plugin / AggregatorPluginManager.php
1 <?php
2
3 namespace Drupal\aggregator\Plugin;
4
5 use Drupal\Core\Cache\CacheBackendInterface;
6 use Drupal\Core\Extension\ModuleHandlerInterface;
7 use Drupal\Core\Plugin\DefaultPluginManager;
8
9 /**
10  * Manages aggregator plugins.
11  *
12  * @see \Drupal\aggregator\Annotation\AggregatorParser
13  * @see \Drupal\aggregator\Annotation\AggregatorFetcher
14  * @see \Drupal\aggregator\Annotation\AggregatorProcessor
15  * @see \Drupal\aggregator\Plugin\AggregatorPluginSettingsBase
16  * @see \Drupal\aggregator\Plugin\FetcherInterface
17  * @see \Drupal\aggregator\Plugin\ProcessorInterface
18  * @see \Drupal\aggregator\Plugin\ParserInterface
19  * @see plugin_api
20  */
21 class AggregatorPluginManager extends DefaultPluginManager {
22
23   /**
24    * Constructs a AggregatorPluginManager object.
25    *
26    * @param string $type
27    *   The plugin type, for example fetcher.
28    * @param \Traversable $namespaces
29    *   An object that implements \Traversable which contains the root paths
30    *   keyed by the corresponding namespace to look for plugin implementations.
31    * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
32    *   Cache backend instance to use.
33    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
34    *   The module handler.
35    */
36   public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
37     $type_annotations = [
38       'fetcher' => 'Drupal\aggregator\Annotation\AggregatorFetcher',
39       'parser' => 'Drupal\aggregator\Annotation\AggregatorParser',
40       'processor' => 'Drupal\aggregator\Annotation\AggregatorProcessor',
41     ];
42     $plugin_interfaces = [
43       'fetcher' => 'Drupal\aggregator\Plugin\FetcherInterface',
44       'parser' => 'Drupal\aggregator\Plugin\ParserInterface',
45       'processor' => 'Drupal\aggregator\Plugin\ProcessorInterface',
46     ];
47
48     parent::__construct("Plugin/aggregator/$type", $namespaces, $module_handler, $plugin_interfaces[$type], $type_annotations[$type]);
49     $this->setCacheBackend($cache_backend, 'aggregator_' . $type . '_plugins');
50   }
51
52 }