From df475af2fd2f1448367a2c0193d08b9bc2ed8fb3 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 7 Oct 2014 20:47:44 +0300 Subject: [PATCH] Add back Twig::processString() as it is used in plugins --- system/src/Grav/Common/Twig.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/system/src/Grav/Common/Twig.php b/system/src/Grav/Common/Twig.php index 75d492846..d99bd275f 100644 --- a/system/src/Grav/Common/Twig.php +++ b/system/src/Grav/Common/Twig.php @@ -185,6 +185,24 @@ class Twig return $output; } + /** + * @param string $string string to render. + * @param array $vars Optional variables + * @return string + */ + public function processString($string, array $vars = array()) + { + // override the twig header vars for local resolution + $this->grav->fireEvent('onTwigStringVariables'); + $vars += $this->twig_vars; + + $name = '@Var:' . $string; + $this->setTemplate($name, $string); + $output = $this->twig->render($name, $vars); + + return $output; + } + /** * Twig process that renders the site layout. This is the main twig process that renders the overall * page and handles all the layout for the site display.