Skip to content
docsv0.1.0

AutocompleteHtmlRenderer

HTML {@see ComponentRendererInterface} for the `autocomplete` contract: an Alpine-bound `<input>` + listbox pair driven by `milpaAutocomplete(...)`, boot-configured with the component's source/endpoint/persistence options and the signed state envelope the client echoes back on every interaction.

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

AutocompleteHtmlRenderer::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

AutocompleteHtmlRenderer::render()

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

Renders one `autocomplete` component to HTML. Throws `InvalidArgumentException` if `$component`'s contract name is anything other than `"autocomplete"` — this renderer is intentionally single- purpose, not a generic dispatcher.

Parameters

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