You are here

public function FileDefinitionDiscoveryBase::getDefinition in Libraries API 8.3

Gets a library definition by its ID.

@todo Consider returning a classed object instead of an array or at least document and validate the array structure.

Parameters

string $id: The library ID.

Return value

array The library definition.

Throws

\Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException

Overrides DefinitionDiscoveryInterface::getDefinition

File

src/ExternalLibrary/Definition/FileDefinitionDiscoveryBase.php, line 48

Class

FileDefinitionDiscoveryBase
Provides a base implementation for file-based definition discoveries.

Namespace

Drupal\libraries\ExternalLibrary\Definition

Code

public function getDefinition($id) {
  if (!$this
    ->hasDefinition($id)) {
    throw new LibraryDefinitionNotFoundException($id);
  }
  return $this->serializer
    ->decode($this
    ->getSerializedDefinition($id));
}