class JsDelivr

  1. 8.x-3.x src/Plugin/Provider/JsDelivr.php JsDelivr
  2. 7.x-3.x includes/cdn/JsDelivr.php JsDelivr

The "jsdelivr" CDN Provider plugin.

Plugin annotation

@BootstrapProvider(
  id = "jsdelivr",
  label = @Translation("jsDelivr"),
  description = @Translation("<a href=:jsdelivr target=_blank>jsDelivr</a> is a free multi-CDN infrastructure that uses <a href=:maxcdn target=_blank>MaxCDN</a>, <a href=:cloudflare target=_blank>Cloudflare</a> and many others to combine their powers for the good of the open source community... <a href=:read_more target=_blank>read more</a>", arguments = {
    ":jsdelivr" = "https://www.jsdelivr.com",
    ":maxcdn" = "https://www.maxcdn.com",
    ":cloudflare" = "https://www.cloudflare.com",
    ":read_more" = "https://www.jsdelivr.com/about",
  }),
  weight = -1
)

Hierarchy

Expanded class hierarchy of JsDelivr

Related topics

Namespace

Drupal\bootstrap\Plugin\Provider
Source
class JsDelivr extends ApiProviderBase {

  /**
   * {@inheritdoc}
   */
  protected function getApiAssetsUrlTemplate() {
    return 'https://data.jsdelivr.com/v1/package/npm/@[email protected]@version/flat';
  }

  /**
   * {@inheritdoc}
   */
  protected function getApiVersionsUrlTemplate() {
    return 'https://data.jsdelivr.com/v1/package/npm/@library';
  }

  /**
   * {@inheritdoc}
   */
  protected function getCdnUrlTemplate() {
    return 'https://cdn.jsdelivr.net/npm/@[email protected]@version/@file';
  }

}

Members

Contains filters are case sensitive
Name Modifiers Type Description
ApiProviderBase::discoverCdnAssets protected function Discovers the assets supported by the CDN Provider. Overrides ProviderBase::discoverCdnAssets
ApiProviderBase::discoverCdnThemes protected function Discovers the themes supported by the CDN Provider. Overrides ProviderBase::discoverCdnThemes
ApiProviderBase::discoverCdnVersions protected function Discovers the versions supported by the CDN Provider. Overrides ProviderBase::discoverCdnVersions
ApiProviderBase::getApiAssetsUrl protected function Retrieves the URL to use for determining available versions from the API.
ApiProviderBase::getApiVersionsUrl protected function Retrieves the URL to use for determining available versions from the API.
ApiProviderBase::getCdnUrl protected function Retrieves a CDN URL based on provided variables.
ApiProviderBase::isValidVersion public static function Checks whether a version is valid.
ApiProviderBase::mapLibrary protected function Allows providers a way to map a library to a different library.
ApiProviderBase::mapVersion protected function Allows providers a way to map a version to a different version. Overrides ProviderBase::mapVersion
ApiProviderBase::parseAssets protected function Parses assets provided by the API data.
ApiProviderBase::parseVersions protected function Parses available versions provided by the API data.
ApiProviderBase::processDefinition Deprecated public function Overrides ProviderBase::processDefinition
ApiProviderBase::requestApiAssets protected function Requests available assets from the CDN Provider API.
ApiProviderBase::requestApiVersions public function Requests available versions from the CDN Provider API.
JsDelivr::getApiAssetsUrlTemplate protected function Retrieves the API URL template to use when requesting a specific asset. Overrides ApiProviderBase::getApiAssetsUrlTemplate
JsDelivr::getApiVersionsUrlTemplate protected function Retrieves the API URL template to use for determining available versions. Overrides ApiProviderBase::getApiVersionsUrlTemplate
JsDelivr::getCdnUrlTemplate protected function Retrieves the CDN URL template to use. Overrides ApiProviderBase::getCdnUrlTemplate
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
ProviderBase::$assets Deprecated protected property The currently set assets.
ProviderBase::$cacheTtl protected property The cache TTL values, in seconds, keyed by type.
ProviderBase::$cdnAssets protected property The currently set CDN assets, keyed by a hash identifier.
ProviderBase::$cdnExceptions protected property A list of currently set Exception objects.
ProviderBase::$keyValue protected property The cache backend used for storing various permanent CDN Provider data.
ProviderBase::$keyValueExpirable protected property The cache backend used for storing various expirable CDN Provider data.
ProviderBase::$themes protected property The themes supplied by the CDN Provider, keyed by version.
ProviderBase::$versions protected property The versions supplied by the CDN Provider.
ProviderBase::addCdnException protected function Adds a new CDN Provider exception.
ProviderBase::alterFrameworkLibrary public function Overrides ProviderInterface::alterFrameworkLibrary
ProviderBase::cacheGet protected function Retrieves a value from the CDN Provider cache.
ProviderBase::getApi Deprecated public function Overrides ProviderInterface::getApi
ProviderBase::getAssets Deprecated public function Overrides ProviderInterface::getAssets
ProviderBase::getCacheId protected function Retrieves the unique cache identifier for the CDN Provider.
ProviderBase::getCacheTtl public function Retrieves the cache time-to-live (TTL) value. Overrides ProviderInterface::getCacheTtl
ProviderBase::getCdnAssets public function Retrieves the assets from the CDN, if any. Overrides ProviderInterface::getCdnAssets
ProviderBase::getCdnAssetsCacheData protected function Retrieves the data used to create a hash for CDN Assets.
ProviderBase::getCdnExceptions public function Retrieves any CDN ProviderException objects triggered during discovery. Overrides ProviderInterface::getCdnExceptions
ProviderBase::getCdnTheme public function Retrieves the currently set CDN Provider theme. Overrides ProviderInterface::getCdnTheme
ProviderBase::getCdnThemes public function Retrieves the themes supported by the CDN Provider. Overrides ProviderInterface::getCdnThemes
ProviderBase::getCdnThemesCacheData protected function Retrieves the data used to create a hash for CDN Themes.
ProviderBase::getCdnVersion public function Retrieves the currently set CDN Provider version. Overrides ProviderInterface::getCdnVersion
ProviderBase::getCdnVersions public function Retrieves the versions supported by the CDN Provider. Overrides ProviderInterface::getCdnVersions
ProviderBase::getCdnVersionsCacheData protected function Retrieves the data used to create a hash for CDN Versions.
ProviderBase::getDescription public function Retrieves the provider description. Overrides ProviderInterface::getDescription
ProviderBase::getKeyValue protected function Retrieves a permanent key/value storage instance.
ProviderBase::getKeyValueExpirable protected function Retrieves a expirable key/value storage instance.
ProviderBase::getLabel public function Retrieves the provider human-readable label. Overrides ProviderInterface::getLabel
ProviderBase::getOverrides protected function Retrieves the Drupal overrides CSS file.
ProviderBase::getThemes public function Retrieves the themes supported by the CDN Provider. Overrides ProviderInterface::getThemes
ProviderBase::getVersions public function Retrieves the versions supported by the CDN Provider. Overrides ProviderInterface::getVersions
ProviderBase::hasError Deprecated public function Overrides ProviderInterface::hasError
ProviderBase::isImported Deprecated public function Overrides ProviderInterface::isImported
ProviderBase::processApi Deprecated public function Overrides ProviderInterface::processApi
ProviderBase::request protected function Initiates an HTTP request.
ProviderBase::resetCache public function Removes any cached data the CDN Provider may have. Overrides ProviderInterface::resetCache
ProviderBase::setCdnExceptions protected function Sets CDN Provider exceptions, replacing any existing exceptions.
ProviderBase::supportsThemes public function Indicates whether the CDN Provider supports themes. Overrides ProviderInterface::supportsThemes
ProviderBase::supportsVersions public function Indicates whether the CDN Provider supports versions. Overrides ProviderInterface::supportsVersions
ProviderBase::trackCdnExceptions public function Tracks any newly generated CDN exceptions generated during a callable. Overrides ProviderInterface::trackCdnExceptions
ProviderInterface::CACHE_ASSETS constant Defines the "assets" cache type.
ProviderInterface::CACHE_LIBRARY constant Defines the "library" cache type.
ProviderInterface::CACHE_THEMES constant Defines the "themes" cache type.
ProviderInterface::CACHE_VERSIONS constant Defines the "versions" cache type.
ProviderInterface::TTL_FOREVER constant Defines the "forever" time-to-live (TTL) value.
ProviderInterface::TTL_NEVER constant Defines the "never" time-to-live (TTL) value.
ProviderInterface::TTL_ONE_DAY constant Defines the "one day" time-to-live (TTL) value.
ProviderInterface::TTL_ONE_MONTH constant Defines the "one month" time-to-live (TTL) value.
ProviderInterface::TTL_ONE_WEEK constant Defines the "one week" time-to-live (TTL) value.
ProviderInterface::TTL_ONE_YEAR constant Defines the "one year" time-to-live (TTL) value.
ProviderInterface::TTL_SIX_MONTHS constant Defines the "six months" time-to-live (TTL) value.
ProviderInterface::TTL_THREE_MONTHS constant Defines the "three months" time-to-live (TTL) value.