Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 069f7b8

Browse filesBrowse files
committed
feature symfony#5115 Flesh out twig-template for custom data-collector (Darien Hager)
This PR was submitted for the 2.6 branch but it was merged into the 2.3 branch instead (closes symfony#5115). Discussion ---------- Flesh out twig-template for custom data-collector I think this template will make it easier for people to get started, since it demonstrates a greater range of visual features. Users less-experienced in twig may have problems with the old skeleton, since it removes the default CSS styles when visiting the main panel. Adding `{{parent()}}` to the `head` block makes it friendlier. Commits ------- ffaff9b Remove indentations for all-whitespace lines. b0e2b83 Fix incorrect instructions regarding linking to the "full panel", improve roll-over data example. cc5ae6a Flesh out twig-template for custom data-collector
2 parents d4999ed + ffaff9b commit 069f7b8
Copy full SHA for 069f7b8

File tree

Expand file treeCollapse file tree

1 file changed

+35
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+35
-6
lines changed

‎cookbook/profiler/data_collector.rst

Copy file name to clipboardExpand all lines: cookbook/profiler/data_collector.rst
+35-6Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,56 @@ 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' %}
115115
116116
{% block toolbar %}
117-
{# the web debug toolbar content #}
117+
{# This toolbar item may appear along the top or 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 piece of data</b>
126+
<span>100 units</div>
127+
</div>
128+
<div class="sf-toolbar-info-piece">
129+
<b>Another quick thing</b>
130+
<span>300 units</div>
131+
</div>
132+
{% endset %}
133+
134+
{# Set the "link" value to false if you do not have a big "panel"
135+
section that you want to direct the user to. #}
136+
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %}
137+
118138
{% endblock %}
119139
120140
{% block head %}
121-
{# if the web profiler panel needs some specific JS or CSS files #}
141+
{# Optional, if you need your own JS or CSS files. #}
142+
{{ parent() }} {# Use parent() to keep the default styles #}
122143
{% endblock %}
123144
124145
{% block menu %}
125-
{# the menu content #}
146+
{# This left-hand menu appears when using the full-screen profiler. #}
147+
<span class="label">
148+
<span class="icon"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAcCAQAAADVGmdYAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffAxkBCDStonIVAAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAHpJREFUOMtj3PWfgXRAuqZd/5nIsIdhVBPFmgqIjCuYOrJsYtz1fxuUOYER2TQID8afwIiQ8YIkI4TzCv5D2AgaWSuExJKMIDbA7EEVhQEWXJ6FKUY4D48m7HYU/EcWZ8JlE6qfMELPDcUJuEMPxvYazYTDWRMjOcUyAEswO+VjeQQaAAAAAElFTkSuQmCC" alt=""/></span>
149+
<strong>Example Collector</strong>
150+
</span>
126151
{% endblock %}
127152
128153
{% block panel %}
129-
{# the panel content #}
154+
{# Optional, for showing the most details. #}
155+
<h2>Example</h2>
156+
<p>
157+
<em>Major information goes here</em>
158+
</p>
130159
{% endblock %}
131160
132161
Each block is optional. The ``toolbar`` block is used for the web debug

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.