Skip to content
docsv0.1.0

ComponentRendererRegistryInterface

Resolves a {@see ComponentRendererInterface} by render target, mirroring the {@see \Milpa\Live\Contracts\Tui\TuiNodeRendererRegistryInterface} pattern (register + supports-based resolve) on the component-renderer side of the render seam.

ComponentRendererRegistryInterface::register()

abstract public function register(Milpa\Live\Contracts\Rendering\ComponentRendererInterface $renderer): void

Registers a renderer. Implementations that keep an ordered list and resolve by first match SHOULD prefer the most recently registered renderer when more than one claims to {@see ComponentRendererInterface::supportsTarget()} the same target.

Parameters

Parameters of register()
NameTypeDescription
$rendererMilpa\Live\Contracts\Rendering\ComponentRendererInterface

ComponentRendererRegistryInterface::resolve()

abstract public function resolve(Milpa\Live\ValueObjects\RenderTarget $target): ?Milpa\Live\Contracts\Rendering\ComponentRendererInterface

Looks up the renderer that {@see ComponentRendererInterface::supportsTarget()} the given target.

Parameters

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

Returns

`null` if no registered renderer supports this target — callers decide whether that is fatal.