AssetsHelper

class AssetsHelper extends Helper

AssetsHelper helps manage asset URLs.

Methods

setCharset(string $charset)

Sets the default charset.

from Helper
string getCharset()

Gets the default charset.

from Helper
__construct(Packages $packages)
string getUrl(string $path, string $packageName = null)

Returns the public url/path of an asset.

string getVersion(string $path, string $packageName = null)

Returns the version of an asset.

string getName()

Returns the canonical name of this helper.

Details

setCharset(string $charset)

Sets the default charset.

Parameters

string $charset The charset

string getCharset()

Gets the default charset.

Return Value

string The default charset

__construct(Packages $packages)

Parameters

Packages $packages

string getUrl(string $path, string $packageName = null)

Returns the public url/path of an asset.

If the package used to generate the path is an instance of UrlPackage, you will always get a URL and not a path.

Parameters

string $path A public path
string $packageName The name of the asset package to use

Return Value

string The public path of the asset

string getVersion(string $path, string $packageName = null)

Returns the version of an asset.

Parameters

string $path A public path
string $packageName The name of the asset package to use

Return Value

string The asset version

string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.html