Class

Symfony\Bundle\TwigBundle\Extension\AssetsExtension

class AssetsExtension extends Twig_Extension

Twig extension for Symfony assets helper

Methods

__construct(ContainerInterface $container, RequestContext $requestContext)

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.

string getName()

Returns the name of the extension.

Details

at line 27
public __construct(ContainerInterface $container, RequestContext $requestContext)

Parameters

ContainerInterface $container
RequestContext $requestContext

at line 38
public array getFunctions()

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

Return Value

array An array of functions

at line 58
public 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

at line 76
public int getAssetsVersion(string $packageName = null)

Returns the version of the assets in a package.

Parameters

string $packageName

Return Value

int

at line 86
public string getName()

Returns the name of the extension.

Return Value

string The extension name