[WebProfilerBundle] tweaked previous merge
This commit is contained in:
parent
155320ae83
commit
7407773234
@ -41,7 +41,6 @@ class ProfilerController extends ContainerAware
|
||||
$panel = $this->container->get('request')->query->get('panel', 'request');
|
||||
$page = $this->container->get('request')->query->get('page', 'home');
|
||||
|
||||
|
||||
if (!$profile = $profiler->loadProfile($token)) {
|
||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:info.html.twig', array('about' => 'no_token', 'token' => $token));
|
||||
}
|
||||
@ -50,8 +49,7 @@ class ProfilerController extends ContainerAware
|
||||
throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token));
|
||||
}
|
||||
|
||||
/** @var $templateManager \Symfony\Bundle\WebProfilerBundle\Profiler\Template */
|
||||
$templateManager = $this->container->get('web_profiler.profiler_template');
|
||||
$templateManager = $this->container->get('web_profiler.template_manager');
|
||||
|
||||
return $this->container->get('templating')->renderResponse($templateManager->getName($profile, $panel), array(
|
||||
'token' => $token,
|
||||
@ -182,13 +180,10 @@ class ProfilerController extends ContainerAware
|
||||
// the profiler is not enabled
|
||||
}
|
||||
|
||||
/** @var $templateManager \Symfony\Bundle\WebProfilerBundle\Profiler\Template */
|
||||
$templateManager = $this->container->get('web_profiler.profiler_template');
|
||||
|
||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array(
|
||||
'position' => $position,
|
||||
'profile' => $profile,
|
||||
'templates' => $templateManager->getTemplates($profile),
|
||||
'templates' => $this->container->get('web_profiler.template_manager')->getTemplates($profile),
|
||||
'profiler_url' => $url,
|
||||
));
|
||||
}
|
||||
|
@ -22,30 +22,18 @@ use Symfony\Bundle\TwigBundle\TwigEngine;
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Artur Wielogórski <wodor@wodor.net>
|
||||
*/
|
||||
class TemplateManager {
|
||||
|
||||
/**
|
||||
* @var \Symfony\Bundle\TwigBundle\TwigEngine
|
||||
*/
|
||||
class TemplateManager
|
||||
{
|
||||
protected $templating;
|
||||
|
||||
/**
|
||||
* @var \Twig_Environment
|
||||
*/
|
||||
protected $twig;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $templates;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\HttpKernel\Profiler\Profiler
|
||||
*/
|
||||
protected $profiler;
|
||||
|
||||
/**
|
||||
* @param \Symfony\Bundle\TwigBundle\TwigEngine $templating
|
||||
* Constructor.
|
||||
*
|
||||
* @param Profiler $profiler
|
||||
* @param TwigEngine $templating
|
||||
* @param \Twig_Environment $twig
|
||||
* @param array $templates
|
||||
*/
|
||||
@ -58,10 +46,14 @@ class TemplateManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
|
||||
* @param $panel
|
||||
* Gets the template name for a given panel.
|
||||
*
|
||||
* @param Profile $profile
|
||||
* @param string $panel
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function getName(Profile $profile, $panel)
|
||||
{
|
||||
@ -75,7 +67,10 @@ class TemplateManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
|
||||
* Gets the templates for a given profile.
|
||||
*
|
||||
* @param Profile $profile
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplates(Profile $profile)
|
||||
@ -89,10 +84,12 @@ class TemplateManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets template names of templates that are
|
||||
* present in the viewed profile
|
||||
* @param \Symfony\Component\HttpKernel\Profiler\Profile $profile
|
||||
* Gets template names of templates that are present in the viewed profile.
|
||||
*
|
||||
* @param Profile $profile
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
protected function getNames(Profile $profile)
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<parameters>
|
||||
<parameter key="web_profiler.debug_toolbar.class">Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener</parameter>
|
||||
<parameter key="web_profiler.profiler_template">Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager</parameter>
|
||||
<parameter key="web_profiler.template_manager.class">Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
@ -18,7 +18,7 @@
|
||||
<argument>%web_profiler.debug_toolbar.position%</argument>
|
||||
</service>
|
||||
|
||||
<service id="web_profiler.profiler_template" class="%web_profiler.profiler_template%">
|
||||
<service id="web_profiler.template_manager" class="%web_profiler.template_manager.class%">
|
||||
<argument type="service" id="profiler" />
|
||||
<argument type="service" id="templating.engine.twig" />
|
||||
<argument type="service" id="twig" />
|
||||
|
Reference in New Issue
Block a user