WebAssetRegistry
Implements WebAssetRegistryInterface, \Joomla\Event\DispatcherAwareInterfaceWeb Asset Registry class
since |
4.0.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Registry constructor
__construct() : mixed
since |
4.0.0 |
---|
Response
mixed
add
Add Asset to registry of known assets
add(string type, \Joomla\CMS\WebAsset\WebAssetItemInterface asset) : self
since |
4.0.0 |
---|
Arguments
- type
string
Asset type, script or style- asset
\Joomla\CMS\WebAsset\WebAssetItemInterface
Asset instance
Response
self
addExtensionRegistryFile
Helper method to register new file with Extension Asset(s) info
addExtensionRegistryFile(string name) : self
since |
4.0.0 |
---|
Arguments
- name
string
A full extension name, actually a name in the /media folder, eg: com_example, plg_system_example etc.
Response
self
addRegistryFile
Register new file with Asset(s) info
addRegistryFile(string path) : self
since |
4.0.0 |
---|
Arguments
- path
string
Relative path
Response
self
addTemplateRegistryFile
Helper method to register new file with Template Asset(s) info
addTemplateRegistryFile(string template, int client) : self
since |
4.0.0 |
---|
Arguments
- template
string
The template name- client
int
The application client id
Response
self
createAsset
Prepare new Asset instance.
createAsset(string name, string uri = null, array options = [], array attributes = [], array dependencies = []) : \Joomla\CMS\WebAsset\WebAssetItem
since |
4.0.0 |
---|
Arguments
- name
string
The asset name- uri
string
The URI for the asset- options
array
Additional options for the asset- attributes
array
Attributes for the asset- dependencies
array
Asset dependencies
Response
\Joomla\CMS\WebAsset\WebAssetItem
dispatchAssetChanged
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
dispatchAssetChanged(string type, \Joomla\CMS\WebAsset\WebAssetItemInterface asset, string change) : void
since |
4.0.0 |
---|
Arguments
- type
string
Asset type, script or style- asset
\Joomla\CMS\WebAsset\WebAssetItemInterface
Asset instance- change
string
A type of change: new, remove, override
exists
Check whether the asset exists in the registry.
exists(string type, string name) : bool
since |
4.0.0 |
---|
Arguments
- type
string
Asset type, script or style- name
string
Asset name
Response
bool
get
Get an existing Asset from a registry, by asset name.
get(string type, string name) : \Joomla\CMS\WebAsset\WebAssetItem
throws |
|
---|---|
since |
4.0.0 |
Arguments
- type
string
Asset type, script or style- name
string
Asset name
Response
\Joomla\CMS\WebAsset\WebAssetItem
getRegistryFiles
Get a list of the registry files
getRegistryFiles() : array
since |
4.0.0 |
---|
Response
array
parseRegistryFile
Parse registry file
parseRegistryFile(string path) : void
throws |
|
---|---|
since |
4.0.0 |
Arguments
- path
string
Relative path to the data file
parseRegistryFiles
Parse registered files
parseRegistryFiles() : void
since |
4.0.0 |
---|
remove
Remove Asset from registry.
remove(string type, string name) : self
since |
4.0.0 |
---|
Arguments
- type
string
Asset type, script or style- name
string
Asset name
Response
self
Properties
dataFilesNew
Files with Asset info. File path should be relative.
example |
of registry file: { "title" : "Example", "name" : "com_example", "author": "Joomla! CMS", "assets": [ { "name": "library1", "version": "3.5.0", "type": "script", "uri": "com_example/library1.min.js" }, { "name": "library2", "version": "3.5.0", "type": "script", "uri": "com_example/library2.min.js", "dependencies": [ "core", "library1" ], "attribute": { "attr-name": "attr value" "defer": true } }, { "name": "library1", "version": "3.5.0", "type": "style", "uri": "com_example/library1.min.css" "attribute": { "media": "all" } }, { "name": "library1", "type": "preset", "dependencies": { "library1#style", "library1#script" } }, ] } |
---|---|
since |
4.0.0 |
Type(s)
array