You are here

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

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

Gets a list of available CDN plugins.

Return value

array List of CDN plugins available.

3 calls to LibrariesCdn::getAvailableCdn()
LibrariesCdn::find in src/LibrariesCdn.php
Return CDN Plugin id's of the CDN who provides a library.
LibrariesCdn::isAvailableCdn in src/LibrariesCdn.php
Check if a CDN plugin is available.
LibrariesCdn::search in src/LibrariesCdn.php
Return CDN Plugin id's of the CDN who provides a library.

File

src/LibrariesCdn.php, line 38
Contains LibrariesCdn.

Class

LibrariesCdn
Class LibrariesCdn.

Namespace

Drupal\libraries_cdn

Code

public static function getAvailableCdn() {
  $options = array();
  $service_basename = 'plugin.manager.librariescdn';
  foreach (\Drupal::service($service_basename)
    ->getDefinitions() as $service => $data) {
    $name = isset($data['label']) ? $data['label'] : $data['id'];
    $options[$data['id']] = $name;
  }
  asort($options);
  return $options;
}