WebAssetItem
Implements WebAssetItemInterfaceWeb Asset Item class
Asset Item are "read only" object, all properties must be set through class constructor. Only properties allowed to be edited is an attributes and an options. Changing an uri or a dependencies are not allowed, prefer to create a new asset instance.
since |
4.0.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor
__construct(string name, string uri = null, array options = [], array attributes = [], array dependencies = []) : mixed
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
mixed
getAttribute
Get the attribute
getAttribute(string key, string default = null) : mixed
since |
4.0.0 |
---|
Arguments
- key
string
An attributes key- default
string
A default value
Response
mixed
getAttributes
Get all attributes
getAttributes() : array
since |
4.0.0 |
---|
Response
array
getDependencies
Return dependencies list
getDependencies() : array
since |
4.0.0 |
---|
Response
array
getName
Return Asset name
getName() : string
since |
4.0.0 |
---|
Response
string
getOption
Get the option
getOption(string key, string default = null) : mixed
since |
4.0.0 |
---|
Arguments
- key
string
An option key- default
string
A default value
Response
mixed
getOptions
Get all options
getOptions() : array
since |
4.0.0 |
---|
Response
array
getUri
Get the file path
getUri(bool resolvePath = true) : string
since |
4.0.0 |
---|
Arguments
- resolvePath
bool
Whether need to search for a real paths
Response
string
The resolved path if resolved, else an empty string.
getVersion
Return Asset version
getVersion() : string
since |
4.0.0 |
---|
Response
string
isPathAbsolute
Check if the Path is relative to /media folder or absolute
isPathAbsolute(string path) : bool
since |
4.0.0 |
---|
Arguments
- path
string
Path to test
Response
bool
isPathExternal
Check if the Path is External
isPathExternal(string path) : bool
since |
4.0.0 |
---|
Arguments
- path
string
Path to test
Response
bool
resolvePath
Resolve path
resolvePath(string path, string type) : string
since |
4.0.0 |
---|
Arguments
- path
string
The path to resolve- type
string
The resolver method
Response
string
setAttribute
Set the attribute
setAttribute(string key, string value = null) : self
since |
4.0.0 |
---|
Arguments
- key
string
An attribute key- value
string
An attribute value
Response
self
setOption
Set the option
setOption(string key, string value = null) : self
since |
4.0.0 |
---|
Arguments
- key
string
An option key- value
string
An option value
Response
self
Properties
attributes
Attributes for the asset, to be rendered in the asset's HTML tag