Adde pathinfo twig function

This commit is contained in:
Andy Miller 2017-05-26 17:52:19 -06:00
parent 0ca58122a9
commit 53bccab326
No known key found for this signature in database
GPG Key ID: E82B8D0EAB94EFB9
2 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@
1. [](#new)
* Added new unified `Utils::getPagePathFromToken()` method which is used by various plugins (Admin, Forms, Downloads, etc.)
* Added 165 new thumbnail images for use in `media.yaml`
* Added `pathinfo()` Twig function
1. [](#improved)
* Optionally remove unpublished pages from the translated languages, move into untranslated list [#1482](https://github.com/getgrav/grav/pull/1482)
* Improved reliability of `hash` file-check method

View File

@ -115,6 +115,7 @@ class TwigExtension extends \Twig_Extension
new \Twig_SimpleFunction('evaluate_twig', [$this, 'evaluateTwigFunc'], ['needs_context' => true, 'needs_environment' => true]),
new \Twig_SimpleFunction('gist', [$this, 'gistFunc']),
new \Twig_SimpleFunction('nonce_field', [$this, 'nonceFieldFunc']),
new \Twig_SimpleFunction('pathinfo', [$this, 'pathinfoFunc']),
new \Twig_simpleFunction('random_string', [$this, 'randomStringFunc']),
new \Twig_SimpleFunction('repeat', [$this, 'repeatFunc']),
new \Twig_SimpleFunction('regex_replace', [$this, 'regexReplace']),
@ -1027,4 +1028,15 @@ class TwigExtension extends \Twig_Extension
{
var_dump($var);
}
/**
* Simple wrapper for pathinfo()
*
* @param $var
* @return mixed
*/
public function pathinfoFunc($var)
{
return pathinfo($var);
}
}