Skip to content
docsv0.1.0

FormPrimitiveHtmlRenderer

HTML {@see ComponentRendererInterface} for the form-field primitive contract family — `input`, `textarea`, `select`, `checkbox`. Renders each field as an Alpine-bound control (`milpaField(...)` / `milpaCheckbox(...)`) wired to the signed state envelope, with shared label/hint/`aria-describedby` wiring across all four field types.

FormPrimitiveHtmlRenderer::__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

Parameters of __construct()
NameTypeDescription
$clientMilpa\Live\Contracts\Client\ClientRuntimeAdapterInterface
$codecMilpa\Live\Contracts\Transport\StateTransferCodecInterface
$templates?Milpa\Live\Contracts\Rendering\TemplateRendererInterface
$dispatcher?Milpa\Interfaces\Event\MilpaEventDispatcherInterface

FormPrimitiveHtmlRenderer::supportsTarget()

public function supportsTarget(Milpa\Live\ValueObjects\RenderTarget $target): bool

True only for {@see RenderTarget::HTML} — this renderer produces server-rendered markup, not another target format.

Parameters

Parameters of supportsTarget()
NameTypeDescription
$targetMilpa\Live\ValueObjects\RenderTarget

FormPrimitiveHtmlRenderer::render()

public function render(Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component, Milpa\Live\ValueObjects\RenderRequest $request): Milpa\Live\ValueObjects\RenderResult

Renders one form-field-primitive component to HTML. Throws `InvalidArgumentException` if `$component`'s contract name is outside {@see self::SUPPORTED} (`input`, `textarea`, `select`, `checkbox`).

Parameters

Parameters of render()
NameTypeDescription
$componentMilpa\Live\Contracts\Component\ComponentDefinitionInterface
$requestMilpa\Live\ValueObjects\RenderRequest