Back to Joomla project (class list)

Class WebAssetItem - list of methods

Web 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.

Extends

Direct known subclasses

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/WebAssetItem.php
Project: Joomla

Method Summary

public
(string $name, string $uri = null, array $options = [], array $attributes = [], array $dependencies = [])

Class constructor
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
Since
  • 4.0.0
Show source code of this method: __construct Source Code

public string
()

Return Asset name
Returns
  • string
Since
  • 4.0.0
Show source code of this method: getName Source Code

public string
()

Return Asset version
Returns
  • string
Since
  • 4.0.0
Show source code of this method: getVersion Source Code

public array
()

Return dependencies list
Returns
  • array
Since
  • 4.0.0
Show source code of this method: getDependencies Source Code

public string
(mixed $resolvePath = true)

Get the file path
Parameters
  • bool $resolvePath Whether need to search for a real paths
Returns
  • string The resolved path if resolved, else an empty string.
Since
  • 4.0.0
Show source code of this method: getUri Source Code

public mixed
(string $key, mixed $default = null)

Get the option
Parameters
  • string $key An option key
  • string $default A default value
Returns
  • mixed
Since
  • 4.0.0
Show source code of this method: getOption Source Code

public self
(string $key, mixed $value = null)

Set the option
Parameters
  • string $key An option key
  • string $value An option value
Returns
  • self
Since
  • 4.0.0
Show source code of this method: setOption Source Code

public array
()

Get all options
Returns
  • array
Since
  • 4.0.0
Show source code of this method: getOptions Source Code

public mixed
(string $key, mixed $default = null)

Get the attribute
Parameters
  • string $key An attributes key
  • string $default A default value
Returns
  • mixed
Since
  • 4.0.0
Show source code of this method: getAttribute Source Code

public self
(string $key, mixed $value = null)

Set the attribute
Parameters
  • string $key An attribute key
  • string $value An attribute value
Returns
  • self
Since
  • 4.0.0
Show source code of this method: setAttribute Source Code

public array
()

Get all attributes
Returns
  • array
Since
  • 4.0.0
Show source code of this method: getAttributes Source Code

protected string
(string $path, string $type)

Resolve path
Parameters
  • string $path The path to resolve
  • string $type The resolver method
Returns
  • string
Since
  • 4.0.0
Show source code of this method: resolvePath Source Code

protected bool
(string $path)

Check if the Path is External
Parameters
  • string $path Path to test
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: isPathExternal Source Code

protected bool
(string $path)

Check if the Path is relative to /media folder or absolute
Parameters
  • string $path Path to test
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: isPathAbsolute Source Code

Properties Summary

protected string
$name
Asset name
Since
  • 4.0.0
protected string
$uri
The URI for the asset
Since
  • 4.0.0
protected array
$options
Additional options for the asset
Since
  • 4.0.0
protected array
$attributes
Attributes for the asset, to be rendered in the asset's HTML tag
Since
  • 4.0.0
protected string[]
$dependencies
Asset dependencies
Since
  • 4.0.0
protected string
$version
Asset version
Since
  • 4.0.0

Tags Summary

Since
4.0.0