HttpFoundationExtension
class HttpFoundationExtension extends AbstractExtension
Twig extension for the Symfony HttpFoundation component.
Methods
__construct(RequestStack $requestStack, RequestContext $requestContext = null) | ||
getFunctions() {@inheritdoc} | ||
string | generateAbsoluteUrl(string $path) Returns the absolute URL for the given absolute or relative path. | |
string | generateRelativePath(string $path) Returns a relative path based on the current Request. | |
string | getName() Returns the name of the extension. |
Details
__construct(RequestStack $requestStack, RequestContext $requestContext = null)
Parameters
RequestStack | $requestStack | |
RequestContext | $requestContext |
getFunctions()
{@inheritdoc}
string generateAbsoluteUrl(string $path)
Returns the absolute URL for the given absolute or relative path.
This method returns the path unchanged if no request is available.
Parameters
string | $path | The path |
Return Value
string | The absolute URL |
See also
Request::getUriForPath() |
string generateRelativePath(string $path)
Returns a relative path based on the current Request.
This method returns the path unchanged if no request is available.
Parameters
string | $path | The path |
Return Value
string | The relative path |
See also
Request::getRelativeUriForPath() |
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/4.0/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.html