You are here

public function ImageEffectsPluginManager::__construct in Image Effects 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageEffectsPluginManager.php \Drupal\image_effects\Plugin\ImageEffectsPluginManager::__construct()
  2. 8.2 src/Plugin/ImageEffectsPluginManager.php \Drupal\image_effects\Plugin\ImageEffectsPluginManager::__construct()

Constructs an ImageEffectsPluginManager object.

Parameters

\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\Extension\ModuleHandlerInterface $module_handler: The module handler.

string $type: The plugin type, for example 'color_selector'.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

Overrides DefaultPluginManager::__construct

File

src/Plugin/ImageEffectsPluginManager.php, line 39

Class

ImageEffectsPluginManager
Plugin manager for image_effects plugins.

Namespace

Drupal\image_effects\Plugin

Code

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $type, ConfigFactoryInterface $config_factory) {
  $path = Container::camelize($type);
  $this->config = $config_factory
    ->get('image_effects.settings');
  parent::__construct("Plugin/image_effects/{$path}", $namespaces, $module_handler);
  $this
    ->alterInfo("image_effects_{$type}_plugin_info");
  $this
    ->setCacheBackend($cache_backend, "image_effects_{$type}_plugins");
  $this->defaults += [
    'plugin_type' => $type,
  ];
}