5 * Contains \Drupal\filefield_sources\FilefieldSourceManager.
8 namespace Drupal\filefield_sources;
10 use Drupal\Core\Cache\CacheBackendInterface;
11 use Drupal\Core\Extension\ModuleHandlerInterface;
12 use Drupal\Core\Plugin\DefaultPluginManager;
15 * Provides a plugin manager for file field source.
17 * @see \Drupal\filefield_sources\Annotation\FilefieldSource
18 * @see \Drupal\filefield_sources\FilefieldSourceInterface
21 class FilefieldSourceManager extends DefaultPluginManager {
24 * Constructs a FilefieldSourceManager object.
26 * @param \Traversable $namespaces
27 * An object that implements \Traversable which contains the root paths
28 * keyed by the corresponding namespace to look for plugin implementations.
29 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
30 * Cache backend instance to use.
31 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
32 * The module handler to invoke the alter hook with.
34 public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
35 $this->setCacheBackend($cache_backend, 'filefield_sources');
37 parent::__construct('Plugin/FilefieldSource', $namespaces, $module_handler, 'Drupal\filefield_sources\FilefieldSourceInterface', 'Drupal\filefield_sources\Annotation\FilefieldSource');
43 public function getDefinitions() {
44 $definitions = parent::getDefinitions();
45 if (!\Drupal::moduleHandler()->moduleExists('imce')) {
46 unset($definitions['imce']);
48 if (!filefield_sources_curl_enabled()) {
49 unset($definitions['remote']);