You are here

public function PhpFileLibraryType::onLibraryLoad in Libraries API 8.3

Reacts to the instantiation of a library.

Parameters

\Drupal\libraries\ExternalLibrary\LibraryInterface $library: The library that is being instantiated.

Overrides LibraryLoadingListenerInterface::onLibraryLoad

File

src/Plugin/libraries/Type/PhpFileLibraryType.php, line 64

Class

PhpFileLibraryType
Plugin annotation @LibraryType("php_file");

Namespace

Drupal\libraries\Plugin\libraries\Type

Code

public function onLibraryLoad(LibraryInterface $library) {

  /** @var \Drupal\libraries\ExternalLibrary\PhpFile\PhpFileLibraryInterface $library */

  // @todo Prevent loading a library multiple times.
  foreach ($library
    ->getPhpFiles() as $file) {
    $this->phpFileLoader
      ->load($file);
  }
}