mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added chunk_split() twig filter
This commit is contained in:
parent
299a658050
commit
d075c29254
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user