class Custom

The "custom" CDN provider plugin.

Plugin annotation

@BootstrapProvider(
  id = "custom",
  label = @Translation("Custom"),
)

Hierarchy

Expanded class hierarchy of Custom

Related topics

Namespace

Drupal\bootstrap\Plugin\Provider
Source
class Custom extends ProviderBase {

  /**
   * {@inheritdoc}
   */
  public function getAssets($types = NULL) {
    $this->assets = [];

    // If no type is set, return all CSS and JS.
    if (!isset($types)) {
      $types = ['css', 'js'];
    }
    $types = is_array($types) ? $types : [$types];

    foreach ($types as $type) {
      if ($setting = $this->theme->getSetting('cdn_custom_' . $type)) {
        $this->assets[$type][] = $setting;
      }
      if ($setting = $this->theme->getSetting('cdn_custom_' . $type . '_min')) {
        $this->assets['min'][$type][] = $setting;
      }
    }
    return parent::getAssets($types);
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
Custom::getAssets public function Retrieves Provider assets for the active provider, if any. Overrides ProviderBase::getAssets
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
ProviderBase::$assets protected property The currently set assets.
ProviderBase::$versions protected property The versions supplied by the CDN provider.
ProviderBase::getApi public function Retrieves the API URL if set. Overrides ProviderInterface::getApi
ProviderBase::getDescription public function Retrieves the provider description. Overrides ProviderInterface::getDescription
ProviderBase::getLabel public function Retrieves the provider human-readable label. Overrides ProviderInterface::getLabel
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 public function Flag indicating that the API data parsing failed. Overrides ProviderInterface::hasError
ProviderBase::isImported public function Flag indicating that the API data was manually imported. Overrides ProviderInterface::isImported
ProviderBase::processApi public function Processes the provider plugin definition upon discovery. Overrides ProviderInterface::processApi
ProviderBase::processDefinition public function Processes the provider plugin definition upon discovery. Overrides ProviderInterface::processDefinition