Skip to content
docsv0.1.0

RenderResult

The output of {@see \Milpa\Live\Contracts\Rendering\ComponentRendererInterface::render()}. `$state` MUST be populated whenever the renderer mounted the component itself (see {@see RenderRequest::$state}), so callers that need to persist or re-encode the resulting state do not have to re-mount to get it.

RenderResult::__construct()

public function __construct(string $output, ?Milpa\Live\ValueObjects\StateSnapshot $state = null, array $assets = [], array $effects = [], Milpa\Live\ValueObjects\RenderTarget $format = Milpa\Live\ValueObjects\RenderTarget::HTML):

Parameters

Parameters of __construct()
NameTypeDescription
$outputstringThe rendered output — HTML markup, or a TUI text block, per `$format`.
$state(StateSnapshot | null)The state that was rendered, populated whenever the renderer mounted or otherwise resolved one.
$assetsarray<string, mixed>Target-specific client assets/metadata (e.g. `'script'` URL, TUI key hints).
$effectsarray<int, array<string, mixed>>Side effects the caller should apply alongside the output.
$formatRenderTargetWhich target this output was rendered for.