public function CDNJS::formatData in Libraries CDN API 7
Same name and namespace in other branches
- 8 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
1 call to CDNJS::formatData()
- CDNJS::getVersions in src/
Plugin/ LibrariesCDN/ CDNJS.php - Return all available version(s).
File
- src/
Plugin/ LibrariesCDN/ CDNJS.php, line 48 - 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;
}
}