You are here

public function AssetLibrary::getLocator in Libraries API 8.3

Gets the locator of this library using the locator factory.

Parameters

\Drupal\Component\Plugin\Factory\FactoryInterface $locator_factory:

Return value

\Drupal\libraries\ExternalLibrary\Local\LocatorInterface

Overrides LocalLibraryInterface::getLocator

See also

\Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::getLocator()

File

src/ExternalLibrary/Asset/AssetLibrary.php, line 120

Class

AssetLibrary
Provides a class for a single attachable asset library.

Namespace

Drupal\libraries\ExternalLibrary\Asset

Code

public function getLocator(FactoryInterface $locator_factory) {

  // @todo Consider consolidating the stream wrappers used here. For now we
  // allow asset libs to live almost anywhere.
  return $locator_factory
    ->createInstance('chain')
    ->addLocator($locator_factory
    ->createInstance('uri', [
    'uri' => 'asset://',
  ]))
    ->addLocator($locator_factory
    ->createInstance('uri', [
    'uri' => 'php-file://',
  ]));
}