Skip to content
docsv0.34.0

AdminPage

Wraps the shell into a full HTML document: the design tokens and bundle, the client runtime and Alpine (served by the panel itself, no build step), the declared locale as `lang`. Owns no surface markup — that is the components' — only the document around them: the panel's own stylesheet ({@see self::css()}: the document painted, a base layer for the raw HTML a section emits, the panel's classes) and the two scripts that keep the viewer's panel preferences: one at the top of `<body>` that applies the stored theme before anything paints, one at the end that stores what the Settings section's `[data-pref]` controls say (`localStorage`, key {@see self::PREFS_KEY}) and applies it — theme on `<html data-theme>`, density on `.mui-shell[data-density]`, the language override by navigating with `?lang=` and keeping it on every in-panel link. Nothing of it is stored on the server; a delegated listener, no per-instance state (greenhouse decisions/0204). **One runtime per page** (greenhouse decisions/0211). The page hand-writes no runtime `<script>` tag any more: given the boot the controller issued and what the compile declared, `LiveBoot::html()` emits — in `<head>`, after the panel's own stylesheets — every declared stylesheet, the boot payload, `milpa-live.js`, `milpa-live-remote.js`, every declared plugin module in declared order, and Alpine LAST, each `defer`, each URL once. The three seed tags (`#milpa-live-signals`, `#milpa-live-persist`, `#milpa-live-computed`) are written here and only here, from the {@see LiveSeeds} the shell merged, so the page never has two places that could disagree about what the store starts with. A document rendered WITHOUT a boot — the 404 of an unknown section, the 500 of a conflict — carries no runtime at all: there is no live component on it to serve.

AdminPage::__construct()

public function __construct(Milpa\Admin\AdminSettings $settings, Milpa\Admin\I18n\Catalog $catalog):

Parameters

Parameters of __construct()
NameTypeDescription
$settingsMilpa\Admin\AdminSettings
$catalogMilpa\Admin\I18n\Catalog

AdminPage::withCatalog()

public function withCatalog(Milpa\Admin\I18n\Catalog $catalog): self

The same document answering in another catalog — a request's `?lang=` — with everything else shared.

Parameters

Parameters of withCatalog()
NameTypeDescription
$catalogMilpa\Admin\I18n\Catalog

AdminPage::render()

public function render(string $shellHtml, string $title = '', ?Milpa\Live\Http\LiveBoot $boot = null, ?Milpa\Live\ValueObjects\ClientAssets $assets = null, ?Milpa\Admin\View\LiveSeeds $seeds = null): string

The document around a rendered shell.

Parameters

Parameters of render()
NameTypeDescription
$shellHtmlstring
$titlestring
$boot(LiveBoot | null)the page's live boot — the endpoint, its session and its CSRF token; null for a document with no live component on it (an error page), which then emits no runtime
$assets(ClientAssets | null)what the compile declared — the stylesheets and modules the components need
$seeds(LiveSeeds | null)the merged signal seeds; the three tags are emitted whenever there is a boot

AdminPage::error()

public function error(int $status, string $message): string

A plain error document in the same skin — the 404 of an unknown section, the 500 of a conflict.

Parameters

Parameters of error()
NameTypeDescription
$statusint
$messagestring

AdminPage::runtimeUrls()

public function runtimeUrls(): array

Where the panel serves each runtime file — its own asset route, so no build step and no CDN ({@see \Milpa\Admin\Controllers\AssetsController} reads them out of `milpa/live-web`).