public function CdnJs::formatData in Libraries CDN API 8
Same name and namespace in other branches
- 7 src/Plugin/LibrariesCDN/CDNJS.php \Drupal\libraries_cdn\Plugin\LibrariesCDN\CDNJS::formatData()
Return the data to use in each method.
Parameters
string $function: The method name.
array $data: The data from query.
Return value
array The resulting array.
Overrides CdnBase::formatData
File
- src/
Plugin/ LibrariesCdn/ CdnJs.php, line 44 - Plugin: CDNJS.
Class
- CdnJs
- Class CdnJs.
Namespace
Drupal\libraries_cdn\Plugin\LibrariesCdnCode
public function formatData($function, array $data = array()) {
switch ($function) {
case 'search':
case 'isAvailable':
return isset($data['results']) ? (array) $data['results'] : $data;
case 'getVersions':
case 'getFiles':
return isset($data['assets']) ? (array) $data['assets'] : $data;
case 'getLatestVersion':
return isset($data['version']) ? $data['version'] : NULL;
default:
return $data;
}
}