1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-26 06:24:32 +02:00

feat(core): add yaml_encode and yaml_decode twig filter #290

This commit is contained in:
Awilum
2019-11-12 17:36:35 +03:00
parent c358ff0abf
commit a1ef3dd245

View File

@@ -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
*/