kimai-plugin-heatmap/EventSubscriber/DashboardSubscriber.php
Christopher Mühl 263ab8a9d9
feat: add dashboard widget with placeholder template
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:51:22 +02:00

29 lines
734 B
PHP

<?php
namespace KimaiPlugin\KimaiHeatmapBundle\EventSubscriber;
use App\Event\DashboardEvent;
use App\Widget\WidgetService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class DashboardSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly WidgetService $widgetService)
{
}
public static function getSubscribedEvents(): array
{
return [
DashboardEvent::class => ['onDashboard', 100],
];
}
public function onDashboard(DashboardEvent $event): void
{
$widget = $this->widgetService->getWidget('HeatmapWidget');
if ($widget !== null) {
$event->addWidget($widget);
}
}
}