Skip to content

Commit

Permalink
Merge pull request #340 from loic425/fix/data-collector
Browse files Browse the repository at this point in the history
Fix data collector
  • Loading branch information
loic425 committed Jun 14, 2021
2 parents b507325 + c55679d commit 603e396
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,18 @@

final class MonofonyDataCollector extends DataCollector
{
public function __construct(array $bundles)
public function __construct()
{
$this->data = [
'version' => MonofonyCoreBundle::VERSION,
'extensions' => [
'MonofonyApiBundle' => ['name' => 'API', 'enabled' => false],
'MonofonyAdminBundle' => ['name' => 'Admin', 'enabled' => false],
'MonofonyFrontBundle' => ['name' => 'Front', 'enabled' => false],
],
];

foreach (array_keys($this->data['extensions']) as $bundleName) {
if (isset($bundles[$bundleName])) {
$this->data['extensions'][$bundleName]['enabled'] = true;
}
}
}

public function getVersion(): string
{
return $this->data['version'];
}

public function getExtensions(): array
{
return $this->data['extensions'];
}

/**
* {@inheritdoc}
*/
Expand All @@ -67,6 +51,6 @@ public function reset(): void
*/
public function getName(): string
{
return 'app';
return 'monofony';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ services:

# Data collectors
Monofony\Bundle\CoreBundle\DataCollector\MonofonyDataCollector:
arguments:
$bundles: '%kernel.bundles%'
tags:
- { name: data_collector, template: '@MonofonyCore/DataCollector/monofony.html.twig', id: monofony_core, priority: -513 }
- { name: data_collector, template: '@MonofonyCore/DataCollector/monofony.html.twig', id: monofony, priority: -513 }
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<span>{{ collector.version }}</span>
</div>
<div class="sf-toolbar-info-piece">
<b>Extensions</b>
{% for extension in collector.extensions %}
<span class="sf-toolbar-status sf-toolbar-status-{{ extension.enabled ? 'green' : 'red' }}">
{{ extension.name }}
</span>
{% endfor %}
<b>Resources</b>
<span>
<a href="https://docs.monofony.com" rel="help">
Read Monofony Docs
</a>
</span>
</div>
</div>
{% endset %}
Expand Down

0 comments on commit 603e396

Please sign in to comment.