MediaSourceManager.php 1.1 KB

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