You are here

function bootstrap_get_cdn_assets in Express 8

Retrieves CDN assets for the active provider, if any.

// Before.
$assets = bootstrap_get_cdn_assets($type, $provider, $theme);

// After.
use Drupal\bootstrap\Bootstrap;
$theme = Bootstrap::getTheme($theme);
$assets = [];
if ($provider = $theme
  ->getProvider($provider)) {
  $assets = $provider
    ->getAssets($type);
}

Parameters

string|array $type: The type of asset to retrieve: "css" or "js", defaults to an array array containing both if not set.

string $provider: The name of a specific CDN provider to use, defaults to the active provider set in the theme settings.

string $theme: The name of a specific theme the settings should be retrieved from, defaults to the active theme.

Return value

array If $type is a string or an array with only one (1) item in it, the assets are returned as an indexed array of files. Otherwise, an associative array is returned keyed by the type.

Deprecated

Will be removed in a future release.

See also

\Drupal\bootstrap\Plugin\Provider\Custom::getAssets()

\Drupal\bootstrap\Plugin\Provider\JsDelivr::getAssets()

\Drupal\bootstrap\Plugin\Provider\ProviderBase::getAssets()

\Drupal\bootstrap\Plugin\Provider\ProviderInterface::getAssets()

\Drupal\bootstrap\Theme::getProvider()

\Drupal\bootstrap\Bootstrap::getTheme()

File

themes/contrib/bootstrap/deprecated.php, line 707
This contains deprecated functions that will be removed in a future release.

Code

function bootstrap_get_cdn_assets($type = NULL, $provider = NULL, $theme = NULL) {
  Bootstrap::deprecated();
  $assets = [];
  if ($provider = Bootstrap::getTheme($theme)
    ->getProvider($provider)) {
    $assets = $provider
      ->getAssets($type);
  }
  return $assets;
}