Back to WebAssetRegistry class

Method remove

public self
remove
(string $type, string $name)
Remove Asset from registry.
Parameters
  • string $type Asset type, script or style
  • string $name Asset name
Returns
  • self
Since
  • 4.0.0

Method remove - Source code

/**
 * Remove Asset from registry.
 *
 * @param   string  $type  Asset type, script or style
 * @param   string  $name  Asset name
 *
 * @return  self
 *
 * @since   4.0.0
 */
public function remove(string $type, string $name) : WebAssetRegistryInterface
{
    if (!empty($this->assets[$type][$name])) {
        $asset = $this->assets[$type][$name];
        unset($this->assets[$type][$name]);
        $this->dispatchAssetChanged($type, $asset, 'remove');
    }
    return $this;
}