function protected function ProviderBase::discoverCdnAssets

8.x-3.x ProviderBase.php protected ProviderBase::discoverCdnAssets($version, $theme = NULL)
7.x-3.x ProviderBase.php protected ProviderBase::discoverCdnAssets($version, $theme)

Discovers the assets supported by the CDN Provider.

CDN Providers should sub-class this method to make requests and/or process any necessary data.


string $version: The version of assets to return.

string $theme: A specific set of themed assets to return, if any.

Return value

\Drupal\bootstrap\Plugin\Provider\CdnAssets A CdnAssets object.


CDN Provider base class.



Source src/Plugin/Provider/ProviderBase.php (line 208)

protected function discoverCdnAssets($version, $theme = NULL) {
  $assets = [];

  // Convert the deprecated array structure into a proper CdnAssets object.
  $data = $this->getAssets();
  foreach (['css', 'js'] as $type) {
    if (isset($data[$type])) {
      foreach ($data[$type] as $file) {
        $assets[] = new CdnAsset($file, NULL, $version);
    if (isset($data['min'][$type])) {
      foreach ($data['min'][$type] as $file) {
        $assets[] = new CdnAsset($file, NULL, $version);

  return new CdnAssets($assets);