Skip to main content

Module widget

Module widget 

Source
Expand description

Dashboard widgets: the stat cards and the latest-records tables a resource can show on the dashboard, and the panel’s own widgets.

A Stat is one card, as Filament’s Stat::make($label, $value) in a stats overview widget: its label is the card’s title, its value the number shown, and an optional description the line under it. A resource gives its cards with IgniteResource::stats (or a runtime resource’s RuntimeData::stats); the panel gives cards of its own with a StatsOverviewWidget passed to Ignite::widget, as Filament’s panel widgets(). The dashboard shows every card in a grid: the panel’s widgets first, in the order they were added, then each resource’s, in the order of the navigation’s resources.

Structs§

FormWidget
A dashboard widget with a short form that creates a record of a resource, as a Filament custom widget with a form: WordPress’s “Quick Draft” (a title, the content and “Save Draft”). Pass it to Ignite::form_widget. The form shows the resource’s fields (all of them, or the ones fields names, in that order) and posts to the resource’s create route with the CSRF token, so the resource’s validation, policy and create_for run as for its own form; the panel then comes back to the dashboard with the flash message. A form that does not validate shows the resource’s create form with its errors. The widget shows only to a user who may create a record of the resource.
LatestRecords
A dashboard table of the newest records of a resource (added in v1).
ListWidget
A dashboard widget that lists rows under a title, as a Filament custom widget with its own view: the rows of WordPress’s “Activity” or “Recently Published” box. Pass it to Ignite::list_widget. The panel renders it with its partials.widgets.list view (a theme can replace it), escaping every label, value and link.
ListWidgetRow
One row of a ListWidget: a label, an optional value beside it and an optional link, such as a post’s title linking to its edit form and its date as the value, as the rows of WordPress’s “Activity” and “Recently Published” boxes.
Stat
One card of the dashboard, as Filament’s Stat::make($label, $value): a title (the label), the number shown and an optional description under it, such as “3 drafts”.
StatWidget
One stat card on the dashboard: a label and a whole-number value.

Constants§

DEFAULT_EMPTY_STATE
What a ListWidget shows when it has no rows, unless it sets its own.

Traits§

StatsOverviewWidget
A widget of the panel’s own on the dashboard, as Filament’s StatsOverviewWidget with its getStats(): the cards it computes for the signed-in user. Pass it to Ignite::widget.

Functions§

safe_url
Whether url is a path of this site or an http(s) URL, so a link cannot run script.