Dashboard final readonly class
Minn\Admin\Dashboard · public/minn/src/Minn/Admin/Dashboard.php · 273 lines
The overview payload: stat cards, the activity chart, and the recent activity feed, plus the per-bar activity drill-down.
Constants and properties
| private | readonly Minn\Db $db | Promoted from the constructor. |
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
| private | readonly Minn\Auth\Capabilities $capabilities | Promoted from the constructor. |
| private | readonly Minn\Admin\ActivityChart $chart | Promoted from the constructor. |
| private | readonly Minn\Admin\ActivityFeed $feed | Promoted from the constructor. |
| private | readonly string $uploadsDir | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db, Minn\Content\Site $site, Minn\Content\Users $users, Minn\Auth\Capabilities $capabilities, Minn\Admin\ActivityChart $chart, Minn\Admin\ActivityFeed $feed, string $uploadsDir)# | |||||||
| method | overview(int $userId, int $days): array# | The stat cards, the metric catalog and layout, the chart, and the feed. | ||||||
| method | metricLayout(int $userId, array $catalog, array $stats): array# | Which cards show: the user's saved picks over the site default over the built-in layout, unknown keys dropped and slots refilled.
@return array{keys: list<string>, defaults: list<string>, custom: bool} | ||||||
| static | cleanMetricKeys(mixed $keys): array# | At most six unique sanitize_key metric ids; anything else drops. | ||||||
| method | activity(int $userId, string $from, string $to): array# | The events behind one chart bar, (from, to] GMT. |
Internals 9
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | postsCard(array $posts, int $userId): array# |
| |||||||||||||||
| private | pagesCard(array $pages): array# |
| |||||||||||||||
| private | usersCard(): array# | ||||||||||||||||
| private | commentsCard(array $comments, int $userId): array# |
| |||||||||||||||
| private | mediaCard(array $media, int $userId): array# |
| |||||||||||||||
| private | metricCatalog(int $userId, array $stats, array $posts, array $pages, array $comments, array $media): array# | The full metric catalog behind the Overview cards: the default layout first, then every cap-gated card the caller may pick. The store group needs the WooCommerce runtime and is honestly absent.
@return list<array> | |||||||||||||||
| private | overlayMetricKeys(array $saved, array $fallback, array $allowed): array# | Overlay saved keys onto a fallback of the same length, dropping keys outside $allowed and de-duplicating left to right.
@return list<string> | |||||||||||||||
| private | statusCounts(string $type): array# | @return array<string, int> counts by status for one post type | |||||||||||||||
| private | commentCounts(): array# | @return array{approved: int, moderated: int} |
Nothing matches.