diff --git a/flextype/twig/YamlTwigExtension.php b/flextype/twig/YamlTwigExtension.php index 5b1555c4..a458fffe 100644 --- a/flextype/twig/YamlTwigExtension.php +++ b/flextype/twig/YamlTwigExtension.php @@ -11,6 +11,7 @@ namespace Flextype; use Twig_Extension; use Twig_SimpleFunction; +use Twig_SimpleFilter; class YamlTwigExtension extends Twig_Extension { @@ -40,6 +41,19 @@ class YamlTwigExtension extends Twig_Extension ]; } + /** + * Returns a list of filters to add to the existing list. + * + * @return array + */ + public function getFilters() : array + { + return [ + new Twig_SimpleFilter('yaml_decode', [$this, 'decode']), + new Twig_SimpleFilter('yaml_encode', [$this, 'encode']), + ]; + } + /** * Encode YAML */