From 4ae1210f486ceb34bde281cb6fcb92c715a597f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?= Date: Thu, 27 Feb 2020 07:13:47 +0000 Subject: [PATCH] Document RenderView method --- templates.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates.rst b/templates.rst index 8e08bb7f042..fffb396eb6c 100644 --- a/templates.rst +++ b/templates.rst @@ -446,6 +446,19 @@ the :class:`Twig\\Environment` class:: } } +Rendering a Template's Content +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The ``renderView()`` method renders a template and returns its content. The content from the template can be used to create a ``Response`` object:: + + use Symfony\Component\HttpFoundation\Response; + + $content = $this->renderView('product/index.html.twig', [ + 'category' => '...', + 'promotions' => ['...', '...'], + ); + + return new Response($content); + Rendering a Template in Emails ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~