3 namespace Drupal\libraries\ExternalLibrary\Version;
5 use Drupal\Core\Cache\CacheBackendInterface;
6 use Drupal\Core\Extension\ModuleHandlerInterface;
7 use Drupal\Core\Plugin\DefaultPluginManager;
8 use Drupal\libraries\Annotation\VersionDetector;
11 * Provides a plugin manager for library version detector plugins.
13 * @see \Drupal\libraries\ExternalLibrary\Version\VersionDetectorInterface
15 class VersionDetectorManager extends DefaultPluginManager {
18 * Constructs a version detector manager.
20 * @param \Traversable $namespaces
21 * An object that implements \Traversable which contains the root paths
22 * keyed by the corresponding namespace to look for plugin implementations.
23 * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
24 * Cache backend instance to use.
25 * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
26 * The module handler to invoke the alter hook with.
28 public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
29 parent::__construct('Plugin/libraries/VersionDetector', $namespaces, $module_handler, VersionDetectorInterface::class, VersionDetector::class);
30 $this->alterInfo('libraries_version_detector_info');
31 $this->setCacheBackend($cache_backend, 'libraries_version_detector_info');