WebLinkExtension
extends AbstractExtension
in package
Twig extension for the Symfony WebLink component.
Tags
Table of Contents
Properties
- $requestStack : mixed
Methods
- __construct() : mixed
- dnsPrefetch() : string
- Resolves a resource origin as early as possible.
- getFilters() : array<string|int, TwigFilter>
- Returns a list of filters to add to the existing list.
- getFunctions() : array<string|int, TwigFunction>
- Returns a list of functions to add to the existing list.
- getNodeVisitors() : array<string|int, NodeVisitorInterface>
- Returns the node visitor instances to add to the existing list.
- getOperators() : array<string|int, array<string|int, mixed>>
- Returns a list of operators to add to the existing list.
- getTests() : array<string|int, TwigTest>
- Returns a list of tests to add to the existing list.
- getTokenParsers() : array<string|int, TokenParserInterface>
- Returns the token parser instances to add to the existing list.
- link() : string
- Adds a "Link" HTTP header.
- preconnect() : string
- Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
- prefetch() : string
- Indicates to the client that it should prefetch this resource.
- preload() : string
- Preloads a resource.
- prerender() : string
- Indicates to the client that it should prerender this resource .
Properties
$requestStack
private
mixed
$requestStack
Methods
__construct()
public
__construct(RequestStack $requestStack) : mixed
Parameters
- $requestStack : RequestStack
dnsPrefetch()
Resolves a resource origin as early as possible.
public
dnsPrefetch(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
Return values
string —The path of the asset
getFilters()
Returns a list of filters to add to the existing list.
public
getFilters() : array<string|int, TwigFilter>
Return values
array<string|int, TwigFilter>getFunctions()
Returns a list of functions to add to the existing list.
public
getFunctions() : array<string|int, TwigFunction>
Return values
array<string|int, TwigFunction>getNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Return values
array<string|int, NodeVisitorInterface>getOperators()
Returns a list of operators to add to the existing list.
public
getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>> —First array of unary operators, second array of binary operators
getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<string|int, TwigTest>
Return values
array<string|int, TwigTest>getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Return values
array<string|int, TokenParserInterface>link()
Adds a "Link" HTTP header.
public
link(string $uri, string $rel[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $rel : string
-
The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
Return values
string —The relation URI
preconnect()
Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
public
preconnect(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
Return values
string —The path of the asset
prefetch()
Indicates to the client that it should prefetch this resource.
public
prefetch(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
Return values
string —The path of the asset
preload()
Preloads a resource.
public
preload(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['crossorigin' => 'use-credentials']")
Return values
string —The path of the asset
prerender()
Indicates to the client that it should prerender this resource .
public
prerender(string $uri[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $uri : string
- $attributes : array<string|int, mixed> = []
-
The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
Return values
string —The path of the asset