class UrlExtension extends Twig_Extension (View source)

Extension that allow render nodes, nodesSources and documents Url

Properties

protected $request
protected $forceLocale
protected $cacheProvider

Methods

__construct(Request $request, CacheProvider $cacheProvider = null, bool $forceLocale = false)

UrlExtension constructor.

string
getName()

No description

array
getFilters()

No description

string
getCacheKey(NodesSources $ns, bool $absolute = false, string $canonicalScheme = '')

No description

string
getUrl(AbstractEntity $mixed = null, array $criteria = [])

Convert an AbstractEntity to an Url.

string
getNodesSourceUrl(NodesSources $ns, array $criteria = []) deprecated

Get nodeSource url using cache.

string
getNodeUrl(Node $node, array $criteria = [])

Get node url using its first source.

Details

__construct(Request $request, CacheProvider $cacheProvider = null, bool $forceLocale = false)

UrlExtension constructor.

Parameters

Request $request
CacheProvider $cacheProvider
bool $forceLocale

string getName()

Return Value

string

array getFilters()

Return Value

array

string getCacheKey(NodesSources $ns, bool $absolute = false, string $canonicalScheme = '')

Parameters

NodesSources $ns
bool $absolute
string $canonicalScheme

Return Value

string

string getUrl(AbstractEntity $mixed = null, array $criteria = [])

Convert an AbstractEntity to an Url.

Compatible AbstractEntity:

  • Document
  • NodesSources
  • Node

Parameters

AbstractEntity $mixed
array $criteria

Return Value

string

Exceptions

Twig_Error_Runtime

string getNodesSourceUrl(NodesSources $ns, array $criteria = []) deprecated

deprecated Use ChainRouter::generate method instead. In Twig you can use {{ path(nodeSource) }} or {{ url(nodeSource) }}

Get nodeSource url using cache.

Parameters

NodesSources $ns
array $criteria

Return Value

string

string getNodeUrl(Node $node, array $criteria = [])

Get node url using its first source.

Parameters

Node $node
array $criteria

Return Value

string