AssetExtension

class AssetExtension extends AbstractExtension

Twig extension for the Symfony Asset component.

Methods

__construct(Packages $packages, HttpFoundationExtension $foundationExtension = null)

Passing an HttpFoundationExtension instance as a second argument must not be relied on as it's only there to maintain BC with older Symfony version. It will be removed in 3.0.

getFunctions()

{@inheritdoc}

string getAssetUrl($path, $packageName = null, $absolute = false, $version = null)

Returns the public url/path of an asset.

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

Returns the version of an asset.

getAssetsVersion($packageName = null)
string getName()

Returns the name of the extension.

Details

__construct(Packages $packages, HttpFoundationExtension $foundationExtension = null)

Passing an HttpFoundationExtension instance as a second argument must not be relied on as it's only there to maintain BC with older Symfony version. It will be removed in 3.0.

Parameters

Packages $packages
HttpFoundationExtension $foundationExtension

getFunctions()

{@inheritdoc}

string getAssetUrl($path, $packageName = null, $absolute = false, $version = 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

$path
$packageName
$absolute
$version

Return Value

string The public path of the asset

string getAssetVersion(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

getAssetsVersion($packageName = null)

Parameters

$packageName

string getName()

Returns the name of the extension.

Return Value

string The extension name

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Bridge/Twig/Extension/AssetExtension.html