mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Adde pathinfo twig function
This commit is contained in:
parent
0ca58122a9
commit
53bccab326
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user