mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 12:47:11 +02:00
added array() function to cast as an array
This commit is contained in:
@@ -78,6 +78,7 @@ class TwigExtension extends \Twig_Extension
|
||||
new \Twig_SimpleFunction('debug', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]),
|
||||
new \Twig_SimpleFunction('gist', [$this, 'gistFunc']),
|
||||
new \Twig_simpleFunction('random_string', [$this, 'randomStringFunc']),
|
||||
new \Twig_SimpleFunction('array', [$this, 'arrayFunc']),
|
||||
new \Twig_simpleFunction('t', [$this, 'translate']),
|
||||
new \Twig_simpleFunction('ta', [$this, 'translateArray'])
|
||||
];
|
||||
@@ -481,6 +482,11 @@ class TwigExtension extends \Twig_Extension
|
||||
return Utils::generateRandomString($count);
|
||||
}
|
||||
|
||||
public function arrayFunc($value)
|
||||
{
|
||||
return (array) $value;
|
||||
}
|
||||
|
||||
public function translateFunc()
|
||||
{
|
||||
return $this->grav['language']->translate(func_get_args());
|
||||
|
||||
Reference in New Issue
Block a user