diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c573db12..7f15db31a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## xx/xx/2017 1. [](#new) + * Added support for 2-Factor Authentication in admin profile * Added `gaussianBlur` media method [#1623](https://github.com/getgrav/grav/pull/1623) - * Added support for 2-Factor Auth in admin profile + * Added new `|chunk_split()` Twig filter 1. [](#improved) * Added options to `Page::summary()` to support size without HTML tags [#1554](https://github.com/getgrav/grav/issues/1554) * Forced `natsort` on plugins to ensure consistent plugin load ordering across platforms [#1614](https://github.com/getgrav/grav/issues/1614) diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index d6f417376..ebd58c338 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -67,6 +67,8 @@ class TwigExtension extends \Twig_Extension new \Twig_SimpleFilter('*ize', [$this, 'inflectorFilter']), new \Twig_SimpleFilter('absolute_url', [$this, 'absoluteUrlFilter']), new \Twig_SimpleFilter('contains', [$this, 'containsFilter']), + new \Twig_SimpleFilter('chunk_split', [$this, 'chunkSplitFilter']), + new \Twig_SimpleFilter('defined', [$this, 'definedDefaultFilter']), new \Twig_SimpleFilter('ends_with', [$this, 'endsWithFilter']), new \Twig_SimpleFilter('fieldName', [$this, 'fieldNameFilter']), @@ -377,6 +379,19 @@ class TwigExtension extends \Twig_Extension return $array; } + /** + * Wrapper for chunk_split() function + * + * @param $value + * @param $chars + * @param string $split + * @return string + */ + public function chunkSplitFilter($value, $chars, $split = '-') + { + return chunk_split($value, $chars, $split); + } + /** * determine if a string contains another *