class AssetsHelper extends CoreAssetsHelper

deprecated since 2.7, will be removed in 3.0. Use the Asset component instead.

AssetsHelper helps manage asset URLs.

Usage:

Methods

setCharset(string $charset)

Sets the default charset.

from Helper
string
getCharset()

Gets the default charset.

from Helper
__construct(string $basePath = null, string|array $baseUrls = array(), string $version = null, string $format = null, array $namedPackages = array())

Constructor.

setDefaultPackage(PackageInterface $defaultPackage)

Sets the default package.

addPackage(string $name, PackageInterface $package)

Adds an asset package to the helper.

getPackage(string $name = null)

Returns an asset package.

string
getVersion(string $packageName = null)

Gets the version to add to public URL.

string
getUrl(string $path, string $packageName = null, string|bool|null $version = null)

Returns the public path.

string
getName()

Returns the canonical name of this helper.

Details

in Helper at line line 31
setCharset(string $charset)

Sets the default charset.

Parameters

string $charset The charset

in Helper at line line 41
string getCharset()

Gets the default charset.

Return Value

string The default charset

at line line 44
__construct(string $basePath = null, string|array $baseUrls = array(), string $version = null, string $format = null, array $namedPackages = array())

Constructor.

Parameters

string $basePath The base path
string|array $baseUrls Base asset URLs
string $version The asset version
string $format The version format
array $namedPackages Additional packages indexed by name

in CoreAssetsHelper at line line 57
setDefaultPackage(PackageInterface $defaultPackage)

Sets the default package.

Parameters

PackageInterface $defaultPackage The default package

in CoreAssetsHelper at line line 68
addPackage(string $name, PackageInterface $package)

Adds an asset package to the helper.

Parameters

string $name The package name
PackageInterface $package The package

in CoreAssetsHelper at line line 82
PackageInterface getPackage(string $name = null)

Returns an asset package.

Parameters

string $name The name of the package or null for the default package

Return Value

PackageInterface An asset package

Exceptions

InvalidArgumentException If there is no package by that name

in CoreAssetsHelper at line line 102
string getVersion(string $packageName = null)

Gets the version to add to public URL.

Parameters

string $packageName A package name

Return Value

string The version string

in CoreAssetsHelper at line line 118
string getUrl(string $path, string $packageName = null, string|bool|null $version = null)

Returns the public path.

Absolute paths (i.e. http://...) are returned unmodified.

Parameters

string $path A path
string $packageName The name of the asset package to use
string|bool|null $version A specific version for the path

Return Value

string The public path

in CoreAssetsHelper at line line 128
string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name