You are here

public function CDNBase::isAvailable in Libraries CDN API 7

Check if library is available.

Return value

bool Return TRUE if the library is available, otherwise, FALSE.

Overrides CDNBaseInterface::isAvailable

3 calls to CDNBase::isAvailable()
CDNBase::getFiles in src/Type/CDNBase.php
Return all available file(s).
CDNBase::getVersions in src/Type/CDNBase.php
Return all available version(s).
CDNJS::getVersions in src/Plugin/LibrariesCDN/CDNJS.php
Return all available version(s).
1 method overrides CDNBase::isAvailable()
Dummy::isAvailable in modules/libraries_cdn_example_plugin/src/Plugin/LibrariesCDN/Dummy.php
Check if library is available.

File

src/Type/CDNBase.php, line 150
Class CDNBase.

Class

CDNBase
Class CDNBase.

Namespace

Drupal\libraries_cdn\Type

Code

public function isAvailable() {
  if (isset($this->configuration['available'])) {
    return (bool) $this->configuration['available'];
  }
  $data = $this
    ->query($this
    ->getURL(__FUNCTION__));
  if (count($this
    ->formatData(__FUNCTION__, $data)) !== 0) {
    $this->configuration['available'] = TRUE;
    return TRUE;
  }
  else {
    $this->configuration['available'] = FALSE;
    return FALSE;
  }
}