Adde pathinfo twig function

This commit is contained in:
Andy Miller
2017-05-26 17:52:19 -06:00
parent 0ca58122a9
commit 53bccab326
2 changed files with 13 additions and 0 deletions

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);
}
}