/** * {@inheritdoc} */ 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); } }
/** * @param \Drupal\libraries\ExternalLibrary\LibraryInterface $external_library * @param string $component_name * * @return string */ protected function getAttachableLibraryId(LibraryInterface $external_library, $component_name) { return $external_library->getId() . MultipleAssetLibraryInterface::SEPARATOR . $component_name; }
/** * {@inheritdoc} */ public function getAttachableAssetLibraries(LibraryInterface $library, LibraryManagerInterface $library_manager) { assert('$library instanceof \\Drupal\\libraries\\ExternalLibrary\\Asset\\AssetLibraryInterface'); /** @var \Drupal\libraries\ExternalLibrary\Asset\AssetLibraryInterface $library */ return [$library->getId() => $library->getAttachableAssetLibrary($library_manager)]; }