[WebProfilerBundle] Made is_ajax available to the view when rendering panels

This commit is contained in:
Victor Berchet 2012-02-12 16:41:23 +01:00
parent b80951c21c
commit ed028d57d5

View File

@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
use Symfony\Component\HttpFoundation\Request;
/** /**
* ProfilerController. * ProfilerController.
@ -27,11 +28,12 @@ class ProfilerController extends ContainerAware
/** /**
* Renders a profiler panel for the given token. * Renders a profiler panel for the given token.
* *
* @param string $token The profiler token * @param Request $request The HTTP request
* @param string $token The profiler token
* *
* @return Response A Response instance * @return Response A Response instance
*/ */
public function panelAction($token) public function panelAction(Request $request, $token)
{ {
$profiler = $this->container->get('profiler'); $profiler = $this->container->get('profiler');
$profiler->disable(); $profiler->disable();
@ -54,6 +56,7 @@ class ProfilerController extends ContainerAware
'panel' => $panel, 'panel' => $panel,
'page' => $page, 'page' => $page,
'templates' => $this->getTemplates($profiler), 'templates' => $this->getTemplates($profiler),
'is_ajax' => $request->isXmlHttpRequest(),
)); ));
} }