Render template from twig extension

后端 未结 3 636
说谎
说谎 2021-02-05 13:00

I have built a twig extension to do some things and one of them is render a template. How can I access from inside the twig extension the engine environment and call the Render

3条回答
  •  名媛妹妹
    2021-02-05 13:20

    Using this function the user can pass the twig environment instance to a twig extension

    private $environment;
    
    public function initRuntime(\Twig_Environment $environment)
    {
        $this->environment = $environment;
    }
    

提交回复
热议问题