You are here

trait RemoteLibraryTrait in Libraries API 8.3

Provides a trait for remote libraries.

Hierarchy

2 files declare their use of RemoteLibraryTrait
AssetLibrary.php in src/ExternalLibrary/Asset/AssetLibrary.php
MultipleAssetLibrary.php in src/ExternalLibrary/Asset/MultipleAssetLibrary.php

File

src/ExternalLibrary/Remote/RemoteLibraryTrait.php, line 8

Namespace

Drupal\libraries\ExternalLibrary\Remote
View source
trait RemoteLibraryTrait {

  /**
   * The remote library URL.
   *
   * @var string
   */
  protected $remoteUrl;

  /**
   * Checks whether the library has a remote URL.
   *
   * This check allows using the same library class for multiple libraries only
   * some of which are available remotely.
   *
   * @return bool
   *   TRUE if the library has a remote URL; FALSE otherwise.
   *
   * @see \Drupal\libraries\ExternalLibrary\Remote\RemoteLibraryInterface::hasRemoteUrl()
   */
  public function hasRemoteUrl() {
    return !empty($this->remoteUrl);
  }

  /**
   * Returns the remote URL of the library.
   *
   * @return string
   *   The remote URL of the library.
   *
   * \Drupal\libraries\ExternalLibrary\Remote\RemoteLibraryInterface::getRemoteUrl()
   */
  public function getRemoteUrl() {
    return $this->remoteUrl;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RemoteLibraryTrait::$remoteUrl protected property The remote library URL.
RemoteLibraryTrait::getRemoteUrl public function Returns the remote URL of the library.
RemoteLibraryTrait::hasRemoteUrl public function Checks whether the library has a remote URL.