You are here

public function JSDelivr::__construct in Libraries CDN API 8

Same name and namespace in other branches
  1. 7 src/Plugin/LibrariesCDN/JSDelivr.php \Drupal\libraries_cdn\Plugin\LibrariesCDN\JSDelivr::__construct()

Constructs a \Drupal\Component\Plugin\PluginBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides CdnBase::__construct

File

src/Plugin/LibrariesCdn/JsDelivr.php, line 25
Plugin: jsDelivr.

Class

JSDelivr
Class JsDelivr.

Namespace

Drupal\libraries_cdn\Plugin\LibrariesCdn

Code

public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
  if (empty($configuration['urls'])) {
    $configuration['urls'] = array();
  }
  $configuration['urls'] += array(
    'isAvailable' => 'http://api.jsdelivr.com/v1/jsdelivr/libraries/%s',
    'getInformation' => 'http://api.jsdelivr.com/v1/jsdelivr/libraries?name=%s&fields=name,mainfile,lastversion,description,homepage,github,author',
    'getVersions' => 'http://api.jsdelivr.com/v1/jsdelivr/libraries?name=%s&fields=versions',
    'getFiles' => 'http://api.jsdelivr.com/v1/jsdelivr/libraries?name=%s&fields=assets',
    'search' => 'http://api.jsdelivr.com/v1/jsdelivr/libraries?name=*%s*',
    'convertFiles' => '//cdn.jsdelivr.net/%s/%s/',
  );
  parent::__construct($configuration, $plugin_id, $plugin_definition);
}