diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php index 588c77838..ae0d71a4d 100644 --- a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php +++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php @@ -23,7 +23,7 @@ use Twig\TwigFunction; * * The logic of the function is based on the original routing extension. */ -class ChillTwigRoutingHelper +class ChillTwigRoutingHelper extends AbstractExtension { /** * @var RoutingExtension @@ -75,7 +75,13 @@ class ChillTwigRoutingHelper return $this->originalExtension->getPath($name, $params, $relative); } - #[\Twig\Attribute\AsTwigFilter('chill_return_path_label')] + public function getFilters(): array + { + return [ + new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)), + ]; + } + public function getLabelReturnPath($default) { $request = $this->requestStack->getCurrentRequest(); diff --git a/src/Bundle/ChillMainBundle/config/services/templating.yaml b/src/Bundle/ChillMainBundle/config/services/templating.yaml index ee56ba8f6..1e73771a5 100644 --- a/src/Bundle/ChillMainBundle/config/services/templating.yaml +++ b/src/Bundle/ChillMainBundle/config/services/templating.yaml @@ -29,6 +29,8 @@ services: $originalExtension: '@twig.extension.routing' autoconfigure: true autowire: true + tags: + - { name: twig.extension } Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension: autoconfigure: true