You are here

public function GlobalLocator::locate in Libraries API 8.3

Locates a library.

Parameters

\Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface $library: The library to locate.

Overrides LocatorInterface::locate

See also

\Drupal\libraries\ExternalLibrary\Local\LocatorInterface::locate()

File

src/Plugin/libraries/Locator/GlobalLocator.php, line 66

Class

GlobalLocator
Provides a locator based on global configuration.

Namespace

Drupal\libraries\Plugin\libraries\Locator

Code

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();
}