8000 [WebProfilerBundle] Add a link of the current rendered template on th… · symfony/symfony@a36b3cc · GitHub
[go: up one dir, main page]

Skip to content

Commit a36b3cc

Browse files
[WebProfilerBundle] Add a link of the current rendered template on the twig tab of the web debug toolbar
1 parent 38b5992 commit a36b3cc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ CHANGELOG
66

77
* Add a "role=img" and an explicit title in the .svg file used by the web debug toolbar
88
to improve accessibility with screen readers for blind users
9+
* Add a link of the current rendered template on the twig tab of the web debug toolbar
10+
to improve user experience and make the debug easier
911

1012
6.1
1113
---

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@
6262
<b>Macro Calls</b>
6363
<span class="sf-toolbar-status">{{ collector.macrocount }}</span>
6464
</div>
65+
<div class="sf-toolbar-info-piece">
66+
<b>Current rendered template</b>
67+
{%- set template = collector.templates|keys|first -%}
68+
{%- set file = collector.templatePaths[template]|default(false) -%}
69+
{%- set link = file ? file|file_link(1) : false -%}
70+
{% if link %}
71+
<a href="{{ link }}" title="{{ file }}">{{ template }}</a>
72+
{% else %}
73+
{{ template }}
74+
{% endif %}
75+
</div>
6576
{% endset %}
6677

6778
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }}
< 371D div class="d-flex flex-row">

0 commit comments

Comments
 (0)
0