Skip to content

Commit cc5ae6a

Browse files
Darien Hagerweaverryan
Darien Hager
authored andcommitted
Flesh out twig-template for custom data-collector
1 parent d4999ed commit cc5ae6a

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

cookbook/profiler/data_collector.rst

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,51 @@ Adding Web Profiler Templates
106106
-----------------------------
107107

108108
When you want to display the data collected by your data collector in the web
109-
debug toolbar or the web profiler, create a Twig template following this
110-
skeleton:
109+
debug toolbar or the web profiler, you will need to create a Twig template. The
110+
following example can help you get started:
111111

112112
.. code-block:: jinja
113113
114114
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
115-
115+
116116
{% block toolbar %}
117-
{# the web debug toolbar content #}
117+
{# Used for the menu items along the bottom of the screen. #}
118+
{% set icon %}
119+
<span class="icon"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAcCAQAAADVGmdYAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffAxkBCDStonIVAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAHpJREFUOMtj3PWfgXRAuqZd/5nIsIdhVBPFmgqIjCuYOrJsYtz1fxuUOYER2TQID8afwIiQ8YIkI4TzCv5D2AgaWSuExJKMIDbA7EEVhQEWXJ6FKUY4D48m7HYU/EcWZ8JlE6qfMELPDcUJuEMPxvYazYTDWRMjOcUyAEswO+VjeQQaAAAAAElFTkSuQmCC" alt=""/></span>
120+
<span class="sf-toolbar-status">Example</span>
121+
{% endset %}
122+
123+
{% set text %}
124+
<div class="sf-toolbar-info-piece">
125+
<b>Quick roll-over</b>
126+
<b>info here</b>
127+
</div>
128+
{% endset %}
129+
130+
{# Omit this next line if you do not have a "panel" section #}
131+
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %}
132+
118133
{% endblock %}
119-
134+
120135
{% block head %}
121-
{# if the web profiler panel needs some specific JS or CSS files #}
136+
{# Optional, if you need your own JS or CSS files. #}
137+
{{ parent() }} {# Use parent() to keep the default styles #}
122138
{% endblock %}
123-
139+
124140
{% block menu %}
125-
{# the menu content #}
141+
{# The left-hand menu content when looking at profiler data. #}
142+
<span class="label">
143+
<span class="icon"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAcCAQAAADVGmdYAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffAxkBCDStonIVAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAHpJREFUOMtj3PWfgXRAuqZd/5nIsIdhVBPFmgqIjCuYOrJsYtz1fxuUOYER2TQID8afwIiQ8YIkI4TzCv5D2AgaWSuExJKMIDbA7EEVhQEWXJ6FKUY4D48m7HYU/EcWZ8JlE6qfMELPDcUJuEMPxvYazYTDWRMjOcUyAEswO+VjeQQaAAAAAElFTkSuQmCC" alt=""/></span>
144+
<strong>Example Collector</strong>
145+
</span>
126146
{% endblock %}
127-
147+
128148
{% block panel %}
129-
{# the panel content #}
149+
{# Optional, for showing the most details. #}
150+
<h2>Example</h2>
151+
<p>
152+
<em>Major information goes here</em>
153+
</p>
130154
{% endblock %}
131155
132156
Each block is optional. The ``toolbar`` block is used for the web debug

0 commit comments

Comments
 (0)