public function CdnBase::getFiles in Libraries CDN API 8
Return all available file(s).
Parameters
array $version: Filter the returning array with this one.
Return value
array Return an array with available files of the library.
Overrides CdnBaseInterface::getFiles
1 call to CdnBase::getFiles()
- CdnBase::getLocalCopy in src/
CdnBase.php - Copy a library from the CDN to the local filesystem.
File
- src/
CdnBase.php, line 187 - Class CdnBase.
Class
- CdnBase
- Class CdnBase.
Namespace
Drupal\libraries_cdnCode
public function getFiles(array $versions = array()) {
if (!$this
->isAvailable()) {
return array();
}
$data = $this
->formatData(__FUNCTION__, $this
->query($this
->getURL(__FUNCTION__)));
$results = array();
foreach ($data as $asset) {
if (isset($asset['version']) && isset($asset['files']) && is_array($asset['files'])) {
$results[$asset['version']] = $this
->convertFiles($asset['files'], $asset['version']);
}
}
return empty($versions) ? $results : array_intersect_key($results, array_combine(array_values($versions), array_values($versions)));
}