public function JSDelivr::formatData in Libraries CDN API 7
Same name and namespace in other branches
- 8 src/Plugin/LibrariesCdn/JsDelivr.php \Drupal\libraries_cdn\Plugin\LibrariesCdn\JSDelivr::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/ JSDelivr.php, line 48 - Plugin: jsDelivr.
Class
- JSDelivr
- Class JSDelivr.
Namespace
Drupal\libraries_cdn\Plugin\LibrariesCDNCode
public function formatData($function, array $data = array()) {
switch ($function) {
case 'getVersions':
return isset($data[0]) && isset($data[0]['versions']) ? $data[0]['versions'] : array();
case 'getFiles':
return isset($data[0]) && isset($data[0]['assets']) ? $data[0]['assets'] : array();
case 'getLatestVersion':
return isset($data['lastversion']) ? $data['lastversion'] : NULL;
case 'getInformation':
return isset($data[0]) ? $data[0] : array();
default:
return $data;
}
}