You are here

public function FeedsPluginManager::__construct in Feeds 8.3

Constructs a new \Drupal\feeds\Plugin\Type\FeedsPluginManager object.

Parameters

string $type: The plugin type. Either fetcher, parser, or processor, handler, source, target, or other.

\Traversable $namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations.

\Drupal\Core\Cache\CacheBackendInterface $cache_backend: Cache backend instance to use.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler to invoke the alter hook with.

Overrides DefaultPluginManager::__construct

File

src/Plugin/Type/FeedsPluginManager.php, line 41

Class

FeedsPluginManager
Manages Feeds plugins.

Namespace

Drupal\feeds\Plugin\Type

Code

public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) {
  $type_annotations = [
    'fetcher' => 'Drupal\\feeds\\Annotation\\FeedsFetcher',
    'parser' => 'Drupal\\feeds\\Annotation\\FeedsParser',
    'processor' => 'Drupal\\feeds\\Annotation\\FeedsProcessor',
    'source' => 'Drupal\\feeds\\Annotation\\FeedsSource',
    'target' => 'Drupal\\feeds\\Annotation\\FeedsTarget',
  ];
  $plugin_interfaces = [
    'fetcher' => 'Drupal\\feeds\\Plugin\\Type\\Fetcher\\FetcherInterface',
    'parser' => 'Drupal\\feeds\\Plugin\\Type\\Parser\\ParserInterface',
    'processor' => 'Drupal\\feeds\\Plugin\\Type\\Processor\\ProcessorInterface',
    'source' => 'Drupal\\feeds\\Plugin\\Type\\Source\\SourceInterface',
    'target' => 'Drupal\\feeds\\Plugin\\Type\\Target\\TargetInterface',
  ];
  $this->pluginType = $type;
  $this->subdir = 'Feeds/' . ucfirst($type);
  $this->discovery = new AnnotatedClassDiscovery($this->subdir, $namespaces, $type_annotations[$type]);
  $this->discovery = new OverridableDerivativeDiscoveryDecorator($this->discovery);
  $this->factory = new FeedsAnnotationFactory($this, $plugin_interfaces[$type]);
  $this->moduleHandler = $module_handler;
  $this
    ->alterInfo("feeds_{$type}_plugins");
  $this
    ->setCacheBackend($cache_backend, "feeds_{$type}_plugins");
}