public function AssetManager::set

Registers an asset to the current asset manager.

Parameters

string $name The asset name:

AssetInterface $asset The asset:

Throws

\InvalidArgumentException If the asset name is invalid

1 call to AssetManager::set()
LazyAssetManager::get in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php
Gets an asset by name.

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php, line 63

Class

AssetManager
Manages assets.

Namespace

Assetic

Code

public function set($name, AssetInterface $asset) {
  if (!ctype_alnum(str_replace('_', '', $name))) {
    throw new \InvalidArgumentException(sprintf('The name "%s" is invalid.', $name));
  }
  $this->assets[$name] = $asset;
}