From 25e7bf52cdf656c1556fbaa02f9bb353195b2ef0 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 11 Aug 2019 11:45:53 +0300 Subject: [PATCH] Flextype Core: I18nTwigExtension - new filter `tr` added. --- flextype/twig/I18nTwigExtension.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/flextype/twig/I18nTwigExtension.php b/flextype/twig/I18nTwigExtension.php index 02004365..af37c15e 100644 --- a/flextype/twig/I18nTwigExtension.php +++ b/flextype/twig/I18nTwigExtension.php @@ -12,6 +12,7 @@ namespace Flextype; use Flextype\Component\I18n\I18n; use Twig_Extension; use Twig_SimpleFunction; +use Twig_SimpleFilter; class I18nTwigExtension extends Twig_Extension { @@ -27,6 +28,18 @@ class I18nTwigExtension extends Twig_Extension ]; } + /** + * Returns a list of filters to add to the existing list. + * + * @return array + */ + public function getFilters() : array + { + return [ + new Twig_SimpleFilter('tr', [$this, 'tr']), + ]; + } + /** * Translate string */