function bootstrap_cdn_provider

8.x-3.x deprecated.php bootstrap_cdn_provider($provider = NULL, $reset = FALSE)
7.x-3.x bootstrap_cdn_provider($provider = NULL, $reset = FALSE)

Retrieves a list of available CDN providers for the Bootstrap framework.

  // Before.
  $providers = bootstrap_cdn_provider();
  $jsdelivr = bootstrap_cdn_provider('jsdelivr');

  // After.
  use Drupal\bootstrap\Bootstrap;
  use Drupal\bootstrap\Plugin\ProviderManager;

  $theme = Bootstrap::getTheme();

  // Get provider definitions, the "equivalent" for bootstrap_cdn_provider().
  $provider_manager = new ProviderManager($theme);
  $providers = $provider_manager->getDefinitions();
  $jsdelivr = $provider_manager->getDefinition('jsdelivr');

  // You should, however, use the the fully initialized classes made
  // available through a theme instance.
  $providers = $theme->getProviders();
  $jsdelivr = $theme->getProvider('jsdelivr');


string $provider: A specific provider data to return.

bool $reset: Toggle determining whether or not to reset the database cache.

Return value

array|false An associative array of CDN providers, keyed by their machine name if $provider is not set. If $provider is set and exists, it's individual data array will be returned. If $provider is set and the data does not exist then FALSE will be returned.


Will be removed in a future release.

Source ./deprecated.php (line 677)

function bootstrap_cdn_provider($provider = NULL, $reset = FALSE) {
  $provider_manager = new ProviderManager(Bootstrap::getTheme());
  if ($reset) {
  if (isset($provider)) {
    if ($provider_manager->hasDefinition($provider)) {
      return $provider_manager->getDefinition($provider);
    return FALSE;
  return $provider_manager->getDefinitions();