TemplateRendererInterface
Renders a named template file against a params array into an HTML string. This is the templating adapter seam: an HTML {@see ComponentRendererInterface} composes markup by rendering per-component template files through here rather than concatenating strings itself, so the template engine (Latte, a minimal built-in engine, ...) can be swapped without touching renderer code.
TemplateRendererInterface::setViewPath()
abstract public function setViewPath(string $path): voidSets the base directory template paths passed to {@see render()} are resolved against. Implementations MUST reject paths outside this directory (e.g. via `..` traversal) when resolving a template.
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string |
Throws
\InvalidArgumentException If `$path` does not exist or is not a directory.
TemplateRendererInterface::render()
abstract public function render(string $template, array $params = []): stringRenders the named template (resolved relative to the current view path) with the given params and returns the resulting HTML string.
Parameters
| Name | Type | Description |
|---|---|---|
| $template | string | |
| $params | array<string, mixed> | Values the template may reference; implementations decide their own escaping/interpolation rules. |