You are here

public function AssetLibrary::getAttachableAssetLibrary in Libraries API 8.3

Returns a core library array structure for this library.

@todo Document the return value.

Parameters

\Drupal\libraries\ExternalLibrary\LibraryManagerInterface $library_manager: The library manager that can be used to fetch dependencies.

Return value

array

Throws

\Drupal\libraries\ExternalLibrary\Exception\InvalidLibraryDependencyException

\Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException

\Drupal\libraries\ExternalLibrary\Exception\LibraryTypeNotFoundException

\Drupal\Component\Plugin\Exception\PluginException

Overrides AssetLibraryInterface::getAttachableAssetLibrary

See also

\Drupal\libraries\ExternalLibrary\Asset\getAttachableAssetLibraries::getAttachableAssetLibraries()

File

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

Class

AssetLibrary
Provides a class for a single attachable asset library.

Namespace

Drupal\libraries\ExternalLibrary\Asset

Code

public function getAttachableAssetLibrary(LibraryManagerInterface $library_manager) {
  if (!$this
    ->canBeAttached()) {
    throw new LibraryNotInstalledException($this);
  }
  return [
    'version' => $this
      ->getVersion(),
    'css' => $this
      ->processCssAssets($this->cssAssets),
    'js' => $this
      ->processJsAssets($this->jsAssets),
    'dependencies' => $this->attachableDependencies,
  ];
}