ComponentRenderer
in package
Standalone component renderer for when Symfony is not loaded.
Replaces include_component() / get_component() in standalone mode. Locates the component class, executes it, renders the template, and returns HTML.
Usage: $html = ComponentRenderer::render('display', 'sidebar', ['resource' => $r]); $html = ComponentRenderer::renderPartial('module', '_partial', ['items' => $items]);
Table of Contents
Methods
- render() : string
- Render a component: execute its class and render its template.
- renderPartial() : string
- Render a partial template (no component class execution).
Methods
render()
Render a component: execute its class and render its template.
public
static render(string $module, string $component[, array<string|int, mixed> $vars = [] ]) : string
Parameters
- $module : string
-
Module name
- $component : string
-
Component name (e.g., 'sidebar')
- $vars : array<string|int, mixed> = []
-
Variables to pass to the component
Return values
stringrenderPartial()
Render a partial template (no component class execution).
public
static renderPartial(string $module, string $partial[, array<string|int, mixed> $vars = [] ]) : string
Parameters
- $module : string
-
Module name
- $partial : string
-
Partial name (with leading underscore, e.g., '_item')
- $vars : array<string|int, mixed> = []
-
Variables to pass