StateMachineHtmlRenderer
HTML {@see ComponentRendererInterface} for the `state-machine` contract — the counterpart the dashboard renderer never was (greenhouse decisions/0164). `DashboardHtmlRenderer` renders dashboard primitives and throws for everything else, so a state-machine page had no server renderer; this is it, single-component on purpose (it throws for any contract but `state-machine`), so the page controller dispatches to it by contract name. A state-machine is DECLARABLE by data (its `machine` — initial + transitions — arrives in the props, greenhouse decisions/0095), so this renders the CURRENT state and the transitions available from it as actions the live wire fires over `POST {route}`. The server owns the state; the transition buttons carry the action name for the client to fire and for the endpoint to advance and re-sign.
StateMachineHtmlRenderer::__construct()
public function __construct(Milpa\Live\Contracts\Client\ClientRuntimeAdapterInterface $client, Milpa\Live\Contracts\Transport\StateTransferCodecInterface $codec, ?Milpa\Live\Contracts\Rendering\TemplateRendererInterface $templates = null, ?Milpa\Interfaces\Event\MilpaEventDispatcherInterface $dispatcher = null):Parameters
| Name | Type | Description |
|---|---|---|
| $client | Milpa\Live\Contracts\Client\ClientRuntimeAdapterInterface | |
| $codec | Milpa\Live\Contracts\Transport\StateTransferCodecInterface | |
| $templates | ?Milpa\Live\Contracts\Rendering\TemplateRendererInterface | |
| $dispatcher | ?Milpa\Interfaces\Event\MilpaEventDispatcherInterface |
StateMachineHtmlRenderer::supportsTarget()
public function supportsTarget(Milpa\Live\ValueObjects\RenderTarget $target): boolThis renderer targets HTML only.
Parameters
| Name | Type | Description |
|---|---|---|
| $target | Milpa\Live\ValueObjects\RenderTarget |
StateMachineHtmlRenderer::render()
public function render(Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component, Milpa\Live\ValueObjects\RenderRequest $request): Milpa\Live\ValueObjects\RenderResultRender one `state-machine` component to HTML: the signed state envelope plus the current state and the transitions available from it. Throws when handed any contract other than `state-machine` — this renderer is intentionally single-family, and the page controller dispatches to it by contract name.
Parameters
| Name | Type | Description |
|---|---|---|
| $component | Milpa\Live\Contracts\Component\ComponentDefinitionInterface | |
| $request | Milpa\Live\ValueObjects\RenderRequest |