You are here

public function Custom::getAssets in Express 8

Retrieves Provider assets for the active provider, if any.

Parameters

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

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.

Overrides ProviderBase::getAssets

File

themes/contrib/bootstrap/src/Plugin/Provider/Custom.php, line 27
Contains \Drupal\bootstrap\Plugin\Provider\Custom.

Class

Custom
The "custom" CDN provider plugin.

Namespace

Drupal\bootstrap\Plugin\Provider

Code

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);
}