function public function CdnAssets::get

8.x-3.x CdnAssets.php public CdnAssets::get($type, $minified = NULL)

Retrieves specific types of assets.


string $type: The type of assets to retrieve (e.g. css or js).

bool|bool[] $minified: Flag indicating whether only the minified asset should be retrieved. This can be an associative array where the key is the asset type and the value is a boolean indicating whether to use minified assets for that specific type. If not set, all assets are retrieved regardless if they are minified or not.

Return value

\Drupal\bootstrap\Plugin\Provider\CdnAsset[] An array of CdnAsset objects.


Class CdnAssets.



Source src/Plugin/Provider/CdnAssets.php (line 110)

public function get($type, $minified = NULL) {
  // Filter by type.
  $assets = array_filter($this->assets, function(CdnAsset $asset) use ($type) {
    return $asset->getType() === $type;

  // Filter assets by matching minification value.
  if (isset($minified)) {
    $assets = array_filter($assets, function(CdnAsset $asset) use ($minified) {
      return $asset->isMinified() === $minified;

  return $assets;