Back to WebAssetManager class

Method getAsset

public \Joomla\CMS\WebAsset\WebAssetItemInterface
getAsset
(string $type, string $name)
Helper method to get the asset from the registry.
Parameters
  • string $type Asset type, script or style
  • string $name Asset name
Returns
  • \Joomla\CMS\WebAsset\WebAssetItemInterface
Since
  • 4.0.0
-
  • \Joomla\CMS\WebAsset\Exception\UnknownAssetException When Asset cannot be found

Method getAsset - Source code

/**
 * Helper method to get the asset from the registry.
 *
 * @param   string  $type  Asset type, script or style
 * @param   string  $name  Asset name
 *
 * @return  WebAssetItemInterface
 *
 * @throws  UnknownAssetException  When Asset cannot be found
 *
 * @since   4.0.0
 */
public function getAsset(string $type, string $name) : WebAssetItemInterface
{
    return $this->registry->get($type, $name);
}