diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index db3a86bfdab..233b36a4f16 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -106,27 +106,56 @@ Adding Web Profiler Templates ----------------------------- When you want to display the data collected by your data collector in the web -debug toolbar or the web profiler, create a Twig template following this -skeleton: +debug toolbar or the web profiler, you will need to create a Twig template. The +following example can help you get started: .. code-block:: jinja {% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} {% block toolbar %} - {# the web debug toolbar content #} + {# This toolbar item may appear along the top or bottom of the screen.#} + {% set icon %} + + Example + {% endset %} + + {% set text %} +
+ Quick piece of data + 100 units
+ +
+ Another quick thing + 300 units
+ + {% endset %} + + {# Set the "link" value to false if you do not have a big "panel" + section that you want to direct the user to. #} + {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %} + {% endblock %} {% block head %} - {# if the web profiler panel needs some specific JS or CSS files #} + {# Optional, if you need your own JS or CSS files. #} + {{ parent() }} {# Use parent() to keep the default styles #} {% endblock %} {% block menu %} - {# the menu content #} + {# This left-hand menu appears when using the full-screen profiler. #} + + + Example Collector + {% endblock %} {% block panel %} - {# the panel content #} + {# Optional, for showing the most details. #} +

Example

+

+ Major information goes here +

{% endblock %} Each block is optional. The ``toolbar`` block is used for the web debug