8000 Pass the toolbar version number from the controller, to ease transiti… · symfony/symfony@1847285 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1847285

Browse files
committed
Pass the toolbar version number from the controller, to ease transition and keep BC
1 parent a0e03f6 commit 1847285

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
namespace Symfony\Bundle\WebProfilerBundle\Controller;
1313

14-
use Symfony\Component\HttpFoundation\Response;
14+
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
1515
use Symfony\Component\HttpFoundation\RedirectResponse;
16+
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
1619
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
20+
use Symfony\Component\HttpKernel\Kernel;
1721
use Symfony\Component\HttpKernel\Profiler\Profiler;
18-
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
19-
use Symfony\Component\HttpFoundation\Request;
20-
use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager;
2122
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2223

2324
/**
@@ -27,6 +28,9 @@
2728
*/
2829
class ProfilerController
2930
{
31+
const TOOLBAR_VERSION_1 = 1;
32+
const TOOLBAR_VERSION_2 = 2;
33+
3034
private $templateManager;
3135
private $generator;
3236
private $profiler;
@@ -201,12 +205,15 @@ public function toolbarAction(Request $request, $token)
201205
// the profiler is not enabled
202206
}
203207

208+
$toolbarVersion = Kernel::VERSION_ID < 20800 ? self::TOOLBAR_VERSION_1 : self::TOOLBAR_VERSION_2;
209+
204210
return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
205211
'position' => $position,
206212
'profile' => $profile,
207213
'templates' => $this->getTemplateManager()->getTemplates($profile),
208214
'profiler_url' => $url,
209215
'token' => $token,
216+
'toolbar_version' => $toolbarVersion,
210217
)), 200, array('Content-Type' => 'text/html'));
211218
}
212219

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
'collector': profile.getcollector(name),
3131
'profiler_url': profiler_url,
3232
'token': profile.token,
33-
'name': name
33+
'name': name,
34+
'toolbar_version': toolbar_version
3435
})
3536
}}
3637
{% endfor %}

0 commit comments

Comments
 (0)
0