Transferring the result of template rendering to another method

I am trying to assign the $this->render() method to a method (this method displays google map infoWindow / baloon).

I use a method like this to create this infoWindow:

 $infoWindow->setContent(<here goes the template>); 

but passing it as follows:

 $infoWindow->setContent($this->render('WmapFrontBundle:Place:infoWindow.html.twig')); 

don't work at all. How can I assign a template to a variable or pass it to a method?

+4
source share
1 answer

Use renderView() , it returns only the processed template.

render() returns a Response object (with the created template, headers, etc.).

+10
source

All Articles