function public function ProviderBase::getCdnAssets

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

Retrieves the assets from the CDN, if any.

Parameters

string $version: Optional. The version of assets to return. If not set, the setting stored in the active theme will be used.

string $theme: Optional. A specific set of themed assets to return, if any. If not set, the setting stored in the active theme will be used.

Return value

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

Overrides ProviderInterface::getCdnAssets

Class

ProviderBase
CDN Provider base class.

Namespace

Drupal\bootstrap\Plugin\Provider

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

public function getCdnAssets($version = NULL, $theme = NULL) {
  if (!isset($this->cdnAssets)) {
    $this->cdnAssets = $this->cacheGet('assets');
  }

  $data = $this->getCdnAssetsCacheData($version, $theme);
  $hash = Crypt::generateBase64HashIdentifier($data);
  if (!isset($this->cdnAssets[$hash])) {
    $this->cdnAssets[$hash] = $this->cacheGet('assets', $hash, [], function() use ($data) {
      return $this->discoverCdnAssets($data['version'], $data['theme']);
    });
  }

  return $this->cdnAssets[$hash];
}