Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

RoutingExtension.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension;
8
9 use eZ\Publish\Core\MVC\Symfony\Routing\Generator\RouteReferenceGeneratorInterface;
10 use Twig_Extension;
11 use Twig_SimpleFunction;
12
13 class RoutingExtension extends Twig_Extension
14 {
16 private $routeReferenceGenerator;
17
18 public function __construct(RouteReferenceGeneratorInterface $routeReferenceGenerator)
19 {
20 $this->routeReferenceGenerator = $routeReferenceGenerator;
21 }
22
23 public function getFunctions()
24 {
25 return [
26 new Twig_SimpleFunction(
27 'ez_route',
28 [$this, 'getRouteReference']
29 ),
30 ];
31 }
32
33 public function getName()
34 {
35 return 'ezpublish.routing';
36 }
37
44 public function getRouteReference($resource = null, $params = [])
45 {
46 return $this->routeReferenceGenerator->generate($resource, $params);
47 }
48 }
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension
Definition: RoutingExtension.php:14
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension\$routeReferenceGenerator
$routeReferenceGenerator
Definition: RoutingExtension.php:16
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension\getName
getName()
Definition: RoutingExtension.php:33
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension\getFunctions
getFunctions()
Definition: RoutingExtension.php:23
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension\getRouteReference
getRouteReference($resource=null, $params=[])
Definition: RoutingExtension.php:44
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension\__construct
__construct(RouteReferenceGeneratorInterface $routeReferenceGenerator)
Definition: RoutingExtension.php:18
eZ\Publish\Core\MVC\Symfony\Routing\Generator\RouteReferenceGeneratorInterface
Interface for RouteReference generators.
Definition: RouteReferenceGeneratorInterface.php:13
eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension
Definition: ContentExtension.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.