mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-14 01:47:46 +00:00
Refactor ChillTwigRoutingHelper to extend AbstractExtension and register it as a Twig extension
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Templating;
|
||||
|
||||
use Symfony\Bridge\Twig\Extension\RoutingExtension;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\Node\Node;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
@@ -21,11 +22,11 @@ use Twig\TwigFunction;
|
||||
*
|
||||
* The logic of the function is based on the original routing extension.
|
||||
*/
|
||||
final readonly class ChillTwigRoutingHelper
|
||||
final class ChillTwigRoutingHelper extends AbstractExtension
|
||||
{
|
||||
public function __construct(
|
||||
private RequestStack $requestStack,
|
||||
private RoutingExtension $originalExtension,
|
||||
private readonly RequestStack $requestStack,
|
||||
private readonly RoutingExtension $originalExtension,
|
||||
) {}
|
||||
|
||||
public function getFunctions(): array
|
||||
|
||||
@@ -25,6 +25,8 @@ services:
|
||||
Chill\MainBundle\Templating\ChillTwigRoutingHelper:
|
||||
arguments:
|
||||
$originalExtension: '@twig.extension.routing'
|
||||
tags:
|
||||
- { name: twig.extension }
|
||||
|
||||
Chill\MainBundle\Templating\ChillTwigRoutingHelperLabel: ~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user