You are here

public static function LibrariesCdn::setPlugin in Libraries CDN API 8

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

Set the CDN plugin to use.

Parameters

string $plugin: The Plugin ID to use.

string $library: The library to work with.

3 calls to LibrariesCdn::setPlugin()
LibrariesCdn::find in src/LibrariesCdn.php
Return CDN Plugin id's of the CDN who provides a library.
LibrariesCdn::search in src/LibrariesCdn.php
Return CDN Plugin id's of the CDN who provides a library.
libraries_cdn_libraries_info_alter in ./libraries_cdn.module
Implements hook_libraries_info_alter().

File

src/LibrariesCdn.php, line 98
Contains LibrariesCdn.

Class

LibrariesCdn
Class LibrariesCdn.

Namespace

Drupal\libraries_cdn

Code

public static function setPlugin($plugin, $library = NULL, $configuration = array()) {

  /* @var CdnBaseInterface $plugin */
  $plugin = \Drupal::service('plugin.manager.librariescdn')
    ->createInstance($plugin, $configuration);
  if ($library) {
    $plugin
      ->setLibrary($library);
  }
  self::$plugin = $plugin;
}