You are here

public function CdnJs::__construct in Libraries CDN API 8

Same name and namespace in other branches
  1. 7 src/Plugin/LibrariesCDN/CDNJS.php \Drupal\libraries_cdn\Plugin\LibrariesCDN\CDNJS::__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/CdnJs.php, line 25
Plugin: CDNJS.

Class

CdnJs
Class CdnJs.

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.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);
}