From 8eacdbc5fa664d38ece6b6a2b1146944717f0405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 15 Mar 2016 10:21:11 +0100 Subject: [PATCH] fix grammar + improve comprehension --- .../development/user-interface/delegated-blocks.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/development/user-interface/delegated-blocks.rst b/source/development/user-interface/delegated-blocks.rst index e3f4e49ee..74dd97dc2 100644 --- a/source/development/user-interface/delegated-blocks.rst +++ b/source/development/user-interface/delegated-blocks.rst @@ -18,8 +18,8 @@ Examples : This is possible using `the symfony dispatcher event `_. -Inserting a delegated block inside of a template -================================================ +Inserting a delegated block inside a template +============================================== Use the twig function :code:`chill_delegated_block`. @@ -27,10 +27,12 @@ Example : .. code-block:: html+jinja - {{ chill_delegated_block('my_block', { 'person': person }) }} +
{{ chill_delegated_block('my_block', { 'person': person }) }}
In this example, the block name is :code:`my_block`, and the context is an array : :code:`{ 'person': person }`. +The :code:`div` will be filled with the html produced by the bundles which suscribed to the event :code:`chill_block.my_block`. + Subscribing to a delegated block ================================= @@ -40,6 +42,10 @@ You should listen to the event :code:`chill_block.block_name`, where `block_name The event passed as argument will be an instance of :class:`Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent`. The context will be available as an array, as described in subscriber example. You may add content to the page using the :method:`Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent::addContent` method. +.. warning:: + + The code inserted by the function :code:`chill_delegated_block` **should be html safe**. You are encouraged to use an instance of the templating engine (aka Twig) to produce clean html. + Example : .. code-block:: php