ToolbarRenderer
API reference › Debug › ToolbarRenderer
Renders shared toolbar views and resolves their assets through Yii2.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Binds toolbar rendering to the Yii view, asset publisher and template path. | ToolbarRenderer |
inject() | Injects toolbar markup immediately before the final closing body tag. | ToolbarRenderer |
renderElement() | Renders the framework-neutral toolbar template through the Yii2 view component. | ToolbarRenderer |
scriptTag() | Renders a script tag for the Yii2-published toolbar runtime. | ToolbarRenderer |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(yii\base\View $view, yii\web\AssetManager $assetManager, string $viewPath)Binds toolbar rendering to the Yii view, asset publisher and template path.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | yii\ | Yii2 PHP view renderer. |
$assetManager | yii\ | Yii2 asset publisher. |
$viewPath | string | Shared toolbar template path or alias. |
inject()
Section titled “inject() ”public function inject(string $html, string $toolbar): stringInjects toolbar markup immediately before the final closing body tag.
Parameters
| Parameter | Type | Description |
|---|---|---|
$html | string | Response HTML. |
$toolbar | string | Rendered toolbar markup. |
Returns
string: HTML containing the toolbar, appended when no closing body tag exists.
renderElement()
Section titled “renderElement() ”public function renderElement(string $dataUrl, list<string> $skipUrls = [], string $position = 'bottom', int $height = 50): stringRenders the framework-neutral toolbar template through the Yii2 view component.
Parameters
| Parameter | Type | Description |
|---|---|---|
$dataUrl | string | Toolbar payload URL. |
$skipUrls | list<string> | Same-origin URLs excluded from AJAX tracking. |
$position | string | Initial toolbar position. |
$height | int | Initial drawer height percentage. |
Returns
string: Rendered toolbar custom element.
scriptTag()
Section titled “scriptTag() ”public function scriptTag(): stringRenders a script tag for the Yii2-published toolbar runtime.
Emits type="module" so the ES-module chunk keeps its own top-level scope and cannot collide with host-page
globals or other classic scripts.
Returns
string: Toolbar runtime script tag.