W3cubDocs

/Symfony 3.3

AssetsExtension deprecated

class AssetsExtension extends Twig_Extension

deprecated

since 2.7, to be removed in 3.0. Use Symfony\Bridge\Twig\Extension\AssetExtension instead.

Twig extension for Symfony assets helper.

Methods

__construct(ContainerInterface $container, RequestContext $requestContext = null)
array getFunctions()

Returns a list of functions to add to the existing list.

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

Returns the public path of an asset.

int getAssetsVersion(string $packageName = null)

Returns the version of the assets in a package.

getName()

{@inheritdoc}

Details

__construct(ContainerInterface $container, RequestContext $requestContext = null)

Parameters

ContainerInterface $container
RequestContext $requestContext

array getFunctions()

Returns a list of functions to add to the existing list.

Return Value

array An array of functions

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

Returns the public path of an asset.

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

Parameters

string $path A public path
string $packageName The name of the asset package to use
bool $absolute Whether to return an absolute URL or a relative one
string|bool|null $version A specific version

Return Value

string A public path which takes into account the base path and URL path

int getAssetsVersion(string $packageName = null)

Returns the version of the assets in a package.

Parameters

string $packageName

Return Value

int

getName()

{@inheritdoc}

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.3/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.html