public function processString($string, array $vars = [])
    {
        // override the twig header vars for local resolution
        $this->grav->fireEvent('onTwigStringVariables');
        $vars += $this->twig_vars;

        $name = '@Var:' . $string;
        $this->setTemplate($name, $string);

        try {
            $output = $this->twig->render($name, $vars);
        } catch (\Twig_Error_Loader $e) {
            throw new \RuntimeException($e->getRawMessage(), 404, $e);
        }

        return $output;
    }
public function processString($string, array $vars = [])
    {
        // override the twig header vars for local resolution
        $this->grav->fireEvent('onTwigStringVariables');
        $vars += $this->twig_vars;

        $name = '@Var:' . $string;
        $this->setTemplate($name, $string);

        try {
            $output = $this->twig->render($name, $vars);
        } catch (\Twig_Error_Loader $e) {
            throw new \RuntimeException($e->getRawMessage(), 404, $e);
        }

        return $output;
    }
public function processString ( $ string , array $ vars = [ ] ) { // override the twig header vars for local resolution $ this -> grav -> fireEvent ( 'onTwigStringVariables' ) ; $ vars += $ this -> twig_vars ; $ name = '@Var:' . $ string ; $ this -> setTemplate ( $ name , $ string ) ; try { $ output = $ this -> twig -> render ( $ name , $ vars ) ; } catch ( \ Twig_Error_Loader $ e ) { throw new \ RuntimeException ( $ e -> getRawMessage ( ) , 404 , $ e ) ; } return $ output ; }
Process a Twig template directly by using a Twig string
and optional array of variables

@param string $string string to render.
@param array  $vars   Optional variables

@return string
Process a Twig template directly by using a Twig string and optional array of variables