.. index::
    single: Events
    single: Block

Events
======

Sometime, you might want to create an area where a block can be added, depending on some external settings. A good example is
a `Comment mechanism`. You might want to create a ``CommentBundle`` to render a `comment thread` on different pages. The comment area can used `Disqus <http://disqus.com>`_ or your own solution.
As part of a full stack solution, you don't know which solution is going to be used. However, you know where the comment area will be located.

The `Event mechanism` implemented in the ``SonataBlockBundle`` tries to address this situation, and to provide a clean syntax:

.. code-block:: jinja

    {# post.tw.. index::
    single: Profiler
    single: Debug

Profiler
========

``BlockBundle`` automatically adds the profiling of blocks in `debug` mode. It adds a new tab in the Symfony web debug toolbar which contains the number of blocks used on a page.
It also provides a panel with the list of all rendered blocks, their memory consumption and their rendering time.

If you want to disable the profiling or configure it, you may add one of the following options in the block configuration file:

.. code-block:: yaml

    # app/config/config.yml

    sonata_block:
        profiler:
            enabled:        %kernel.debug%
            template:       SonataBlockBundle:Profiler:block.html.twig
