/**
* Deactivate an asset item, so it will not be attached to a Document
*
* @param string $type The asset type, script or style
* @param string $name The asset name
*
* @return self
*
* @throws UnknownAssetException When Asset cannot be found
* @throws InvalidActionException When the Manager already attached to a Document
*
* @since 4.0.0
*/
public function disableAsset(string $type, string $name) : WebAssetManagerInterface
{
if ($this->locked) {
throw new InvalidActionException('WebAssetManager is locked, you came late');
}
// Check whether asset exists
$this->registry->get($type, $name);
unset($this->activeAssets[$type][$name]);
// To re-check dependencies
$this->dependenciesIsActual = false;
// For Preset case
if ($type === 'preset') {
$this->disablePresetItems($name);
}
return $this;
}