8000 Reordered the toolbar elements via service priorities · symfony/symfony@5a571b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a571b6

Browse files
committed
Reordered the toolbar elements via service priorities
1 parent f237ff1 commit 5a571b6

File tree

3 files changed

+6
-52
lines changed

3 files changed

+6
-52
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
<services>
1919
<service id="data_collector.config" class="%data_collector.config.class%" public="false">
20-
<tag name="data_collector" template="@WebProfiler/Collector/config.html.twig" id="config" priority="255" />
20+
<tag name="data_collector" template="@WebProfiler/Collector/config.html.twig" id="config" priority="-255" />
2121
<call method="setKernel"><argument type="service" id="kernel" on-invalid="ignore" /></call>
2222
</service>
2323

2424
<service id="data_collector.request" class="%data_collector.request.class%">
2525
<tag name="kernel.event_subscriber" />
26-
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="255" />
26+
<tag name="data_collector" template="@WebProfiler/Collector/request.html.twig" id="request" priority="260" />
2727
</service>
2828

2929
<service id="data_collector.ajax" class="Symfony\Bundle\FrameworkBundle\DataCollector\AjaxDataCollector" public="false">
30-
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="255" />
30+
<tag name="data_collector" template="@WebProfiler/Collector/ajax.html.twig" id="ajax" priority="256" />
3131
</service>
3232

3333
<service id="data_collector.exception" class="%data_collector.exception.class%" public="false">
@@ -46,13 +46,13 @@
4646
</service>
4747

4848
<service id="data_collector.time" class="%data_collector.time.class%" public="false">
49-
<tag name="data_collector" template="@WebProfiler/Collector/time.html.twig" id="time" priority="255" />
49+
<tag name="data_collector" template="@WebProfiler/Collector/time.html.twig" id="time" priority="259" />
5050
<argument type="service" id="kernel" on-invalid="ignore" />
5151
<argument type="service" id="debug.stopwatch" on-invalid="ignore" />
5252
</service>
5353

5454
<service id="data_collector.memory" class="%data_collector.memory.class%" public="false">
55-
<tag name="data_collector" template="@WebProfiler/Collector/memory.html.twig" id="memory" priority="255" />
55+
<tag name="data_collector" template="@WebProfiler/Collector/memory.html.twig" id="memory" priority="258" />
5656
</service>
5757

5858
<service id="data_collector.router" class="%data_collector.router.class%" >

src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<service id="twig.profile" class="Twig_Profiler_Profile" />
8080

8181
<service id="data_collector.twig" class="Symfony\Bridge\Twig\DataCollector\TwigDataCollector" public="false">
82-
<tag name="data_collector" template="@WebProfiler/Collector/twig.html.twig" id="twig" priority="255" />
82+
<tag name="data_collector" template="@WebProfiler/Collector/twig.html.twig" id="twig" priority="257" />
8383
<argument type="service" id="twig.profile" />
8484
</service>
8585

src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public function getName(Profile $profile, $panel)
7272
public function getTemplates(Profile $profile)
7373
{
7474
$templates = $this->getNames($profile);
75-
$templates = $this->reorderTemplates($templates);
7675

7776
foreach ($templates as $name => $template) {
7877
$templates[$name] = $this->twig->loadTemplate($template);
@@ -136,49 +135,4 @@ protected function templateExists($template)
136135

137136
return false;
138137
}
139-
140-
/**
141-
* It changes the default order of collector templates to show them in a
142-
* different order which is better for design and aesthetic reasons.
143-
*
144-
* @param array $templates
145-
*
146-
* @return array
147-
*/
148-
private function reorderTemplates($templates)
149-
{
150-
$templates = $this->moveArrayElementToFirstPosition($templates, 'twig');
151-
$templates = $this->moveArrayElementToFirstPosition($templates, 'memory');
152-
$templates = $this->moveArrayElementToFirstPosition($templates, 'time');
153-
$templates = $this->moveArrayElementToFirstPosition($templates, 'request');
154-
155-
$templates = $this->moveArrayElementToLastPosition($templates, 'config');
156-
157-
return $templates;
158-
}
159-
160-
private function moveArrayElementToFirstPosition($array, $key)
161-
{
162-
if (!array_key_exists($key, $array)) {
163-
return $array;
164-
}
165-
166-
$value = $array[$key];
167-
unset($array[$key]);
168-
169-
return array_merge(array($key => $value), $array);
170-
}
171-
172-
private function moveArrayElementToLastPosition($array, $key)
173-
{
174-
if (!array_key_exists($key, $array)) {
175-
return $array;
176-
}
177-
178-
$value = $array[$key];
179-
unset($array[$key]);
180-
$array[$key] = $value;
181-
182-
return $array;
183-
}
184138
}

0 commit comments

Comments
 (0)
0