-
Notifications
You must be signed in to change notification settings - Fork 0
AdminPages and ListPages
A declarative admin screen. Subclass Core\AdminPage, declare slug/title/capability/assets/view, and the
framework handles admin_menu registration and per-page asset enqueue (gated by the page's hook suffix).
final class ReportsPage extends AdminPage
{
protected string $slug = 'wp-plugin-matrix-reports';
protected string $pageTitle = 'Reports';
protected string $menuTitle = 'Reports';
protected ?string $parentSlug = 'wp-plugin-matrix';
protected function view(): string
{
return '<div class="wrap"><h1>Reports</h1></div>';
}
}Register it by appending to $pages in app/Providers/AdminServiceProvider.php (the generators do this
for you). Generate one with wp matrix:make:adminpage Reports.
An AdminPage subtype that turns a Model into a full CRUD table with zero custom Vue. Declare the
Model + columns + filters; the framework:
- auto-registers 5 REST routes (
index/show/store/update/destroy), - emits the page config into
window.wppmListPages, - renders a Vue + Element Plus table with pagination, search, and sort,
- generates the edit form from the Model's Rules.
final class BooksListPage extends ListPage
{
protected string $slug = 'wp-plugin-matrix-books';
protected string $pageTitle = 'Books';
protected string $menuTitle = 'Books';
protected ?string $parentSlug = 'wp-plugin-matrix';
protected string $resource = 'books';
protected string $model = Book::class;
protected string $shortcode = '[wppm-books]'; // optional: advertised on the page so users find the embed
protected array $columns = [
'id' => ['label' => 'ID', 'sortable' => true],
'title' => ['label' => 'Title', 'sortable' => true],
];
protected array $filters = [
'status' => ['type' => 'select', 'label' => 'Status', 'options' => ['draft' => 'Draft', 'published' => 'Published']],
];
protected array $searchable = ['title'];
protected int $perPage = 20;
}Generate a whole resource (model + migration + controller + listpage + routes) in one shot:
wp matrix:make:resource BookThe
$sortablewhitelist on the Model bounds which columns may be sorted/filtered/searched — it's the SQL-injection guard forpaginate(). Only whitelist columns you intend to expose.
WP Plugin Matrix · GPL-2.0-or-later · source · pages are generated from docs/wiki/ — edit there, not in the wiki UI.
Seams
Tooling