configFactory = $config_factory; $this->locatorFactory = $locator_factory; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get('config.factory'), $container->get('plugin.manager.libraries.locator') ); } /** * Locates a library. * * @param \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface $library * The library to locate. * * @see \Drupal\libraries\ExternalLibrary\Local\LocatorInterface::locate() */ public function locate(LocalLibraryInterface $library) { foreach ($this->configFactory->get('libraries.settings')->get('global_locators') as $locator) { $this->locatorFactory->createInstance($locator['id'], $locator['configuration'])->locate($library); if ($library->isInstalled()) { return; } } $library->setUninstalled(); } }