|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\WebProfilerBundle\Controller;
|
13 | 13 |
|
14 |
| -use Symfony\Component\HttpFoundation\Response; |
| 14 | +use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; |
15 | 15 | 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; |
16 | 19 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
| 20 | +use Symfony\Component\HttpKernel\Kernel; |
17 | 21 | 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; |
21 | 22 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
22 | 23 |
|
23 | 24 | /**
|
|
27 | 28 | */
|
28 | 29 | class ProfilerController
|
29 | 30 | {
|
| 31 | + const TOOLBAR_VERSION_1 = 1; |
| 32 | + const TOOLBAR_VERSION_2 = 2; |
| 33 | + |
30 | 34 | private $templateManager;
|
31 | 35 | private $generator;
|
32 | 36 | private $profiler;
|
@@ -201,12 +205,15 @@ public function toolbarAction(Request $request, $token)
|
201 | 205 | // the profiler is not enabled
|
202 | 206 | }
|
203 | 207 |
|
208 | + $toolbarVersion = Kernel::VERSION_ID < 20800 ? self::TOOLBAR_VERSION_1 : self::TOOLBAR_VERSION_2; |
| 209 | + |
204 | 210 | return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
|
205 | 211 | 'position' => $position,
|
206 | 212 | 'profile' => $profile,
|
207 | 213 | 'templates' => $this->getTemplateManager()->getTemplates($profile),
|
208 | 214 | 'profiler_url' => $url,
|
209 | 215 | 'token' => $token,
|
| 216 | + 'toolbar_version' => $toolbarVersion, |
210 | 217 | )), 200, array('Content-Type' => 'text/html'));
|
211 | 218 | }
|
212 | 219 |
|
|
0 commit comments