You are here

public function Theme::getProvider in Express 8

Retrieves the CDN provider.

Parameters

string $provider: A CDN provider name. Defaults to the provider set in the theme settings.

Return value

\Drupal\bootstrap\Plugin\Provider\ProviderInterface|FALSE A provider instance or FALSE if there is no provider.

File

themes/contrib/bootstrap/src/Theme.php, line 477
Contains \Drupal\bootstrap.

Class

Theme
Defines a theme object.

Namespace

Drupal\bootstrap

Code

public function getProvider($provider = NULL) {

  // Only continue if the theme is Bootstrap based.
  if ($this
    ->isBootstrap()) {
    $provider = $provider ?: $this
      ->getSetting('cdn_provider');
    $provider_manager = new ProviderManager($this);
    if ($provider_manager
      ->hasDefinition($provider)) {
      return $provider_manager
        ->createInstance($provider, [
        'theme' => $this,
      ]);
    }
  }
  return FALSE;
}