class CdnJs in Libraries CDN API 8
Same name and namespace in other branches
- 7 src/Plugin/LibrariesCDN/CDNJS.php \Drupal\libraries_cdn\Plugin\LibrariesCDN\CDNJS
Class CdnJs.
Plugin annotation
@LibrariesCdn(
id = "cdnjs",
description = "CDNJS Integration"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\libraries_cdn\CdnBase implements CdnBaseInterface
- class \Drupal\libraries_cdn\Plugin\LibrariesCdn\CdnJs implements CdnBaseInterface
- class \Drupal\libraries_cdn\CdnBase implements CdnBaseInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of CdnJs
File
- src/
Plugin/ LibrariesCdn/ CdnJs.php, line 21 - Plugin: CDNJS.
Namespace
Drupal\libraries_cdn\Plugin\LibrariesCdnView source
class CdnJs extends CdnBase implements CdnBaseInterface {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
if (empty($configuration['urls'])) {
$configuration['urls'] = array();
}
$configuration['urls'] += array(
'isAvailable' => 'http://api.cdnjs.com/libraries?search=%s',
'getInformation' => 'http://api.cdnjs.com/libraries/%s',
'getVersions' => 'http://api.cdnjs.com/libraries/%s',
'getFiles' => 'http://api.cdnjs.com/libraries/%s',
'search' => 'http://api.cdnjs.com/libraries?search=%s',
'convertFiles' => '//cdnjs.cloudflare.com/ajax/libs/%s/%s/',
);
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
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;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CdnBase:: |
public | function | ||
CdnBase:: |
public | function |
Return the configuration of the object. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Return all available file(s). Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get library information. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get latest version available of a library. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get the library in use. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Copy a library from the CDN to the local filesystem. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get the local directory name of a library. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get the local file name of a library file. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get the default scheme. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get a particular URL. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Get URLs. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Return all available version(s). Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Check if library is available. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Check if a file is available locally. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Request wrapper for querying a CDN. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Make an HTTP Request. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Perform a search for a library. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Set the configuration of the object. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Set the library to work with. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Set default scheme for an url. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Set a particular URL. Overrides CdnBaseInterface:: |
|
CdnBase:: |
public | function |
Set URLs. Overrides CdnBaseInterface:: |
|
CdnJs:: |
public | function |
Return the data to use in each method. Overrides CdnBase:: |
|
CdnJs:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides CdnBase:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |