Skip to content
docsv0.34.0

AdminController

The panel's pages, PSR-7 in and PSR-7 out — the convention `milpa/runtime` dispatches. Every request discovers the sections again from the plugin instances the kernel holds, so what the sidebar lists is what booted, not what was cached. Without a kernel in the container (the app's `public/index.php` registers it) the panel still serves its own sections. The language is the app's (`admin.locale`) unless the request says `?lang=<locale>` with a locale the {@see Catalog} carries — the browser-side override the Settings section offers. The rest of the query travels to the active section as `props['query']`, so a section can read its own (`?session=<id>` opens a timeline inside Dev tools); the shell never interprets it. Who is signed in is whatever the gate in front of the route left on the request ({@see RequestPrincipal}): the panel reads no cookie and mints no identity — it shows the actor the gate authenticated, or nobody. Every page it serves carries ONE live boot (greenhouse decisions/0211): a fresh page session and its CSRF token, bound to the panel's own wire ({@see AdminSettings::liveUrl()}), issued here and emitted by {@see AdminPage} through `LiveBoot::html()` together with whatever the compile declared. An error document gets none: there is no live component on it.

AdminController::__construct()

public function __construct(Milpa\Interfaces\Di\DIContainerInterface $container, object $self, Milpa\Admin\I18n\Catalog $catalog, Milpa\Admin\View\AdminShell $shell, Milpa\Admin\View\AdminPage $page, Milpa\Live\Contracts\Security\CsrfGuardInterface $csrf, Milpa\Admin\AdminSettings $settings):

Parameters

Parameters of __construct()
NameTypeDescription
$containerMilpa\Interfaces\Di\DIContainerInterface
$selfobjectthe admin plugin instance — the one provider the panel can count on without a kernel
$catalogMilpa\Admin\I18n\Catalog
$shellMilpa\Admin\View\AdminShell
$pageMilpa\Admin\View\AdminPage
$csrfMilpa\Live\Contracts\Security\CsrfGuardInterface
$settingsMilpa\Admin\AdminSettings

AdminController::index()

public function index(Psr\Http\Message\ServerRequestInterface $request): Psr\Http\Message\ResponseInterface

`GET {route}` — the first section in sidebar order.

Parameters

Parameters of index()
NameTypeDescription
$requestPsr\Http\Message\ServerRequestInterface

AdminController::section()

public function section(Psr\Http\Message\ServerRequestInterface $request): Psr\Http\Message\ResponseInterface

`GET {route}/s/{id}` — one section, 404 when no plugin declared it.

Parameters

Parameters of section()
NameTypeDescription
$requestPsr\Http\Message\ServerRequestInterface

AdminController::catalogFor()

public function catalogFor(Psr\Http\Message\ServerRequestInterface $request): Milpa\Admin\I18n\Catalog

The catalog this request reads in: the one `?lang=` names when the catalog carries that locale, else the panel's own.

Parameters

Parameters of catalogFor()
NameTypeDescription
$requestPsr\Http\Message\ServerRequestInterface