3 namespace Drupal\media;
5 use Drupal\Core\Cache\CacheBackendInterface;
6 use Drupal\Core\Extension\ModuleHandlerInterface;
7 use Drupal\Core\Plugin\DefaultPluginManager;
8 use Drupal\media\Annotation\MediaSource;
11 * Manages media source plugins.
13 class MediaSourceManager extends DefaultPluginManager {
16 * Constructs a new MediaSourceManager.
18 * @param \Traversable $namespaces
19 * An object that implements \Traversable which contains the root paths
20 * keyed by the corresponding namespace to look for plugin implementations.
21 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
22 * Cache backend instance to use.
23 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
26 public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
27 parent::__construct('Plugin/media/Source', $namespaces, $module_handler, MediaSourceInterface::class, MediaSource::class);
29 $this->alterInfo('media_source_info');
30 $this->setCacheBackend($cache_backend, 'media_source_plugins');