Back to Joomla project (class list)

Class WebAssetRegistry - list of methods

Web Asset Registry class

Extends

Package: Joomla\CMS\WebAsset
Copyright: (C) 2018 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/WebAsset/WebAssetRegistry.php
Project: Joomla

Method Summary

public
()

Registry constructor
Since
  • 4.0.0
Show source code of this method: __construct Source Code

public \Joomla\CMS\WebAsset\WebAssetItem
(string $type, string $name)

Get an existing Asset from a registry, by asset name.
Parameters
  • string $type Asset type, script or style
  • string $name Asset name
Returns
  • \Joomla\CMS\WebAsset\WebAssetItem
Since
  • 4.0.0
-
  • \Joomla\CMS\WebAsset\Exception\UnknownAssetException When Asset cannot be found
Show source code of this method: get Source Code

public self
(string $type, \Joomla\CMS\WebAsset\WebAssetItemInterface $asset)

Add Asset to registry of known assets
Parameters
  • string $type Asset type, script or style
  • \Joomla\CMS\WebAsset\WebAssetItemInterface $asset Asset instance
Returns
  • self
Since
  • 4.0.0
Show source code of this method: add Source Code

public self
(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
Show source code of this method: remove Source Code

public bool
(string $type, string $name)

Check whether the asset exists in the registry.
Parameters
  • string $type Asset type, script or style
  • string $name Asset name
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: exists Source Code

public \Joomla\CMS\WebAsset\WebAssetItem
(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = [])

Prepare new Asset instance.
Parameters
  • string $name The asset name
  • string $uri The URI for the asset
  • array $options Additional options for the asset
  • array $attributes Attributes for the asset
  • array $dependencies Asset dependencies
Returns
  • \Joomla\CMS\WebAsset\WebAssetItem
Since
  • 4.0.0
Show source code of this method: createAsset Source Code

public self
(string $path)

Register new file with Asset(s) info
Parameters
  • string $path Relative path
Returns
  • self
Since
  • 4.0.0
Show source code of this method: addRegistryFile Source Code

public array
()

Get a list of the registry files
Returns
  • array
Since
  • 4.0.0
Show source code of this method: getRegistryFiles Source Code

public self
(string $template, int $client)

Helper method to register new file with Template Asset(s) info
Parameters
  • string $template The template name
  • int $client The application client id
Returns
  • self
Since
  • 4.0.0
Show source code of this method: addTemplateRegistryFile Source Code

public self
(string $name)

Helper method to register new file with Extension Asset(s) info
Parameters
  • string $name A full extension name, actually a name in the /media folder, eg: com_example, plg_system_example etc.
Returns
  • self
Since
  • 4.0.0
Show source code of this method: addExtensionRegistryFile Source Code

protected void
()

Parse registered files
Returns
  • void
Since
  • 4.0.0
Show source code of this method: parseRegistryFiles Source Code

protected void
(mixed $path)

Parse registry file
Parameters
  • string $path Relative path to the data file
Returns
  • void
Since
  • 4.0.0
-
  • \RuntimeException If file is empty or invalid
Show source code of this method: parseRegistryFile Source Code

protected void
(string $type, \Joomla\CMS\WebAsset\WebAssetItemInterface $asset, string $change)

Dispatch an event to notify listeners about asset changes: new, remove, override Events: - onWebAssetRegistryChangedAssetNew When new asset added to the registry - onWebAssetRegistryChangedAssetOverride When the asset overridden - onWebAssetRegistryChangedAssetRemove When new asset was removed from the registry
Parameters
  • string $type Asset type, script or style
  • \Joomla\CMS\WebAsset\WebAssetItemInterface $asset Asset instance
  • string $change A type of change: new, remove, override
Returns
  • void
Since
  • 4.0.0
Show source code of this method: dispatchAssetChanged Source Code

Properties Summary

protected array
$dataFilesNew
Files with Asset info. File path should be relative.
Since
  • 4.0.0
-
  • array
protected array
$dataFilesParsed
List of parsed files
Since
  • 4.0.0
protected array
$assets
Registry of available Assets
Since
  • 4.0.0

Tags Summary

Since
4.0.0