Skip to content

Commit

Permalink
link the console in the profiler toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlokorte committed Feb 6, 2013
1 parent f6929ba commit d28e073
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions DataCollector/DataCollector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/*
* This file is part of the CoreSphereConsoleBundle.
*
* (c) Laszlo Korte <me@laszlokorte.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CoreSphere\ConsoleBundle\DataCollector;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollector AS DataCollectorBase;

class DataCollector extends DataCollectorBase
{

public function collect(Request $request, Response $response, \Exception $exception = null)
{
}


public function getName()
{
return 'coresphere_console';
}
}
17 changes: 17 additions & 0 deletions DependencyInjection/CoreSphereConsoleExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace CoreSphere\ConsoleBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;

class CoreSphereConsoleExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('toolbar_listener.yml');
}
}
5 changes: 5 additions & 0 deletions Resources/config/toolbar_listener.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
coresphere_console.toolbar:
class: CoreSphere\ConsoleBundle\DataCollector\DataCollector
tags:
- { name: data_collector, template: "CoreSphereConsoleBundle:Toolbar:toolbar", id: "coresphere_console" }
15 changes: 15 additions & 0 deletions Resources/views/Toolbar/toolbar.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}

{% block toolbar %}
{% set icon %}
<a href="{{ path('console') }}" class="coresphere_console_popover">
<img width="13" height="28" alt="Console" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAcCAYAAABh2p9gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ
bWFnZVJlYWR5ccllPAAAAG5JREFUeNpi/P//PwM1ARMDlcGogZQDlhMnTlAtmi0sLBip70IkNiOF
rsMwkKGiouL/CE42Bw4cAGOqGejg4AA3mGouRDaYnGSD1YXoFhCyhIVYm4l16UguvmB5keLCAVTk
UNOFjKO13ggwECDAAAMNHZ7ErsJjAAAAAElFTkSuQmCC"/>
<span>Console</span>
</a>
{% endset %}

{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': false } %}
{% endblock %}

0 comments on commit d28e073

Please sign in to comment.