mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix grammar + improve comprehension
This commit is contained in:
parent
2b0bb364f5
commit
8eacdbc5fa
@ -18,8 +18,8 @@ Examples :
|
||||
|
||||
This is possible using `the symfony dispatcher event <http://symfony.com/doc/current/components/event_dispatcher/index.html>`_.
|
||||
|
||||
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 }) }}
|
||||
<div class="my_block">{{ chill_delegated_block('my_block', { 'person': person }) }}</div>
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user