You are here

DevelImageProviderPluginManager.php in Devel images provider 8

Contains \Drupal\devel_image_provider\DevelImageProviderPluginManager.

File

lib/Drupal/devel_image_provider/Plugin/Type/DevelImageProviderPluginManager.php
View source
<?php

/**
 * @file
 * Contains \Drupal\devel_image_provider\DevelImageProviderPluginManager.
 */
namespace Drupal\devel_image_provider\Plugin\Type;

use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Core\Plugin\Discovery\AlterDecorator;
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Core\Plugin\Discovery\CacheDecorator;

/**
 * Devel image provider Plugin manager.
 */
class DevelImageProviderPluginManager extends PluginManagerBase {

  /**
   * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
   *
   * @param array $namespaces
   *   An array of paths keyed by it's corresponding namespaces.
   */
  public function __construct(array $namespaces) {
    $this->discovery = new AnnotatedClassDiscovery('devel_image_provider', 'provider', $namespaces);
    $this->discovery = new AlterDecorator($this->discovery, 'devel_image_provider_plugin_info');

    //$this->discovery = new CacheDecorator($this->discovery, 'devel_image_provider_plugin');
    $this->factory = new DefaultFactory($this->discovery);
  }

  /**
   * Overrides \Drupal\Component\Plugin\PluginManagerBase::getInstance().
   */
  public function getInstance(array $options) {
    if (isset($options['id'])) {
      return $this
        ->createInstance($options['id']);
    }
  }

}

Classes

Namesort descending Description
DevelImageProviderPluginManager Devel image provider Plugin manager.