Skip to content
Permalink
Browse files

EZP-26375: Add siteaccess collector to debug toolbar (#1790)

  • Loading branch information...
wizhippo authored and bdunogier committed Nov 14, 2016
1 parent 5d5ac8a commit e1864c6a2283599394c73923db8f162fc3630cff
@@ -0,0 +1,42 @@
<?php
/**
* This file is part of the eZ Publish Kernel package.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Bundle\EzPublishDebugBundle\Collector;
use eZ\Publish\Core\MVC\Symfony\SiteAccess;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
/**
* Data collector showing siteaccess.
*/
class SiteAccessCollector extends DataCollector
{
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = [
'siteAccess' => $request->attributes->get('siteaccess'),
];
}
public function getName()
{
return 'ezpublish.debug.siteaccess';
}
/**
* Returns siteAccess.
*
* @return SiteAccess
*/
public function getSiteAccess()
{
return $this->data['siteAccess'];
}
}
@@ -1,7 +1,7 @@
parameters:
ezpublish.debug.data_collector.class: eZ\Bundle\EzPublishDebugBundle\Collector\EzPublishCoreCollector
ezpublish_debug.persistence_collector.class: eZ\Bundle\EzPublishDebugBundle\Collector\PersistenceCacheCollector
ezpublish_debug.templates_collector.class: eZ\Bundle\EzPublishDebugBundle\Collector\TemplatesDataCollector
ezpublish_debug.siteaccess_collector.class: eZ\Bundle\EzPublishDebugBundle\Collector\SiteAccessCollector

services:
ezpublish_debug.data_collector:
@@ -21,3 +21,12 @@ services:
id: "ezpublish.debug.persistence"
panelTemplate: "EzPublishDebugBundle:Profiler/persistence:panel.html.twig"
toolbarTemplate: "EzPublishDebugBundle:Profiler/persistence:toolbar.html.twig"

ezpublish_debug.siteaccess_collector:
class: "%ezpublish_debug.siteaccess_collector.class%"
tags:
-
name: ezpublish_data_collector
id: "ezpublish.debug.siteaccess"
panelTemplate: "EzPublishDebugBundle:Profiler/siteaccess:panel.html.twig"
toolbarTemplate: "EzPublishDebugBundle:Profiler/siteaccess:toolbar.html.twig"
@@ -0,0 +1,11 @@
{% if collector.siteAccess is not null %}
<h3>Site Access</h3>
<table>
<tr>
<th>Name</th><td>{{ collector.siteAccess.name }}</td>
</tr>
<tr>
<th>Matching Type</th><td>{{ collector.siteAccess.matchingType }}</td>
</tr>
</table>
{% endif %}
@@ -0,0 +1,11 @@
{% if collector.siteAccess is not null %}
<div class="sf-toolbar-info-piece">
<b>Site Access</b>
</div>
<div class="sf-toolbar-info-piece">
<b>name</b> <span class="sf-toolbar-status sf-toolbar-status-green">{{ collector.siteAccess.name }}</span>
</div>
<div class="sf-toolbar-info-piece">
<b>matching type</b> <span class="sf-toolbar-status sf-toolbar-status-green">{{ collector.siteAccess.matchingType }}</span>
</div>
{% endif %}

0 comments on commit e1864c6

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.