feat: admin dashboard widgets

This commit is contained in:
Björn Fromme committed 2026-08-25 16:31:45 +02:00
1 parent 578a21d327
commit 4e6aaba9ff
17 files changed
+808 -6

No files matched your search

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App\Dashboard\Contract;
use App\Model\DashboardWidget;
/**
* Assembles one dashboard card.
*
* A provider never checks roles itself: it names the one role its widget requires and
* DashboardWidgetRegistry does the asking, so the security.yaml role_hierarchy stays the single
* place where "an admin is also a group admin" is written down.
*/
interface DashboardWidgetProviderInterface
{
/**
* The role this widget requires, checked with isGranted() — so a widget requiring
* ROLE_GROUPS_MANAGER also appears for the roles above it in the hierarchy.
*/
public function getRequiredRole(): string;
/**
* Higher priority widgets come first on the dashboard.
*/
public function getPriority(): int;
/**
* The assembled widget, or null to leave it out entirely.
*
* Null and a widget with no entries are different answers on purpose: null means this
* account has no business seeing the card at all, while an empty entry list means the card
* belongs here but has nothing to show right now, and renders its emptyText instead.
*/
public function build(): ?DashboardWidget;
}