Skip to content
docsv0.44.3

Surface

What a route serves, said in fields instead of prose (greenhouse decisions/0567 §2, slice BV-2). Measured (greenhouse evidence/1101): a resident read the contract of `make`, found no word for a page, and chose «a controller that concatenates HTML» — the cheap path never asked what the route returns. `make` now asks, and answers with this block: `kind` is `visual` (a page a visitor reads), `data` (an API) or `undeclared` (the author has not said, and nothing is scaffolded until they do). A VISUAL SURFACE IS A SCREEN, AND `make` CANNOT DECLARE ONE. The screen store lives in the app runtime, which this package does not know and must not write around (a second writer of `config/screens.json` would be a second authority over what a declaration is). So a page is answered with {@see next()}: the exact `screen:declare` call to run, the way a trial answers with `to_apply`.

Surface::route()

public static function route(string $typed): string

A literal route as HTTP writes it — `/blog` — from what a caller typed (`blog`, `/blog/`).

Parameters

Parameters of route()
NameTypeDescription
$typedstring

Throws

\InvalidArgumentException naming what is wrong with it

Surface::key()

public static function key(string $route): string

What two spellings of one route share: no slash at either end, no case.

Parameters

Parameters of key()
NameTypeDescription
$routestring

Surface::visual()

public static function visual(string $route, string $screen, bool $declared): array

The block for a page: a visual surface whose governed authoring is a screen.

Parameters

Parameters of visual()
NameTypeDescription
$routestring
$screenstring
$declaredbool

Surface::undeclared()

public static function undeclared(string $route): array

The block for a controller whose author has not said what its GET route returns.

Parameters

Parameters of undeclared()
NameTypeDescription
$routestring

Surface::data()

public static function data(string $route): array

The block for a controller that answers data.

Parameters

Parameters of data()
NameTypeDescription
$routestring

Surface::next()

public static function next(string $screen, string $route, string $plugin, string $entity, array $columns): array

The call that declares the page: `screen:declare`, with every argument filled. Two columns or more read as entries — the first is the title, the second the body, the rest are named beside them (`content`). One column is a list (`data-table`): a readable entry needs a title AND a body.

Parameters

Parameters of next()
NameTypeDescription
$screenstring
$routestring
$pluginstring
$entitystring
$columnslist<string>the entity fields the page shows, in order