You are here

interface DefinitionDiscoveryInterface in Libraries API 8.3

Provides an interface for library definition discoveries.

This is similar to the plugin system's DiscoveryInterface, except that this does not require knowing all definitions upfront, so there is no getDefinitions() method.

Hierarchy

Expanded class hierarchy of DefinitionDiscoveryInterface

All classes that implement DefinitionDiscoveryInterface

See also

\Drupal\Component\Plugin\Discovery\DiscoveryInterface

Related topics

1 file declares its use of DefinitionDiscoveryInterface
LibraryManager.php in src/ExternalLibrary/LibraryManager.php
1 string reference to 'DefinitionDiscoveryInterface'
libraries.services.yml in ./libraries.services.yml
libraries.services.yml
1 service uses DefinitionDiscoveryInterface
libraries.definition.discovery in ./libraries.services.yml
Drupal\libraries\ExternalLibrary\Definition\DefinitionDiscoveryInterface

File

src/ExternalLibrary/Definition/DefinitionDiscoveryInterface.php, line 16

Namespace

Drupal\libraries\ExternalLibrary\Definition
View source
interface DefinitionDiscoveryInterface {

  /**
   * Checks whether a library definition exists.
   *
   * @param string $id
   *   The library ID.
   *
   * @return bool
   *   TRUE if a library definition with the given ID exists; FALSE otherwise.
   */
  public function hasDefinition($id);

  /**
   * Gets a library definition by its ID.
   *
   * @param string $id
   *   The library ID.
   *
   * @return array
   *   The library definition.
   *
   * @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException
   *
   * @todo Consider returning a classed object instead of an array or at least
   *   document and validate the array structure.
   */
  public function getDefinition($id);

}

Members

Namesort descending Modifiers Type Description Overrides
DefinitionDiscoveryInterface::getDefinition public function Gets a library definition by its ID. 2
DefinitionDiscoveryInterface::hasDefinition public function Checks whether a library definition exists. 3