Skip to content
PHP Ecosystem
Explore

ToolbarRenderer

API reference › Yii3 Debug › Web › ToolbarRenderer

final readonly classYii3\Debug\Web\ToolbarRenderer
Sourcesrc/Web/ToolbarRenderer.php

Renders shared toolbar views and resolves their assets through Yii3.

MethodDescriptionDefined by
__construct()Creates a toolbar renderer with Yii3 view and asset services.ToolbarRenderer
inject()Injects toolbar markup immediately before the final closing body tag.ToolbarRenderer
render()Renders the shared toolbar element and the Yii3-published runtime.ToolbarRenderer
renderElement()Renders the framework-neutral toolbar template through the Yii3 view component.ToolbarRenderer
scriptTag()Renders a script tag for the Yii3-published toolbar runtime.ToolbarRenderer
public function __construct(Yiisoft\View\WebView $view, Yiisoft\Assets\AssetManager $assetManager, string $viewPath)

Creates a toolbar renderer with Yii3 view and asset services.

Parameters

ParameterTypeDescription
$viewYiisoft\View\WebViewYii3 PHP view renderer.
$assetManagerYiisoft\Assets\AssetManagerYii3 asset publisher.
$viewPathstringResolved path containing the shared debugger templates.
public function inject(string $html, string $toolbar): string

Injects toolbar markup immediately before the final closing body tag.

Parameters

ParameterTypeDescription
$htmlstringResponse HTML.
$toolbarstringRendered toolbar markup.

Returns

string: HTML containing the toolbar, appended when no closing body tag exists.

public function render(string $dataUrl, list<string> $skipUrls = [], string $position = 'bottom', int $height = 50): string

Renders the shared toolbar element and the Yii3-published runtime.

Parameters

ParameterTypeDescription
$dataUrlstringToolbar payload URL.
$skipUrlslist<string>Same-origin URLs excluded from AJAX tracking.
$positionstringInitial toolbar position.
$heightintInitial drawer height percentage.

Returns

string: Toolbar element followed by its published runtime tag.

public function renderElement(string $dataUrl, list<string> $skipUrls = [], string $position = 'bottom', int $height = 50): string

Renders the framework-neutral toolbar template through the Yii3 view component.

Parameters

ParameterTypeDescription
$dataUrlstringToolbar payload URL.
$skipUrlslist<string>Same-origin URLs excluded from AJAX tracking.
$positionstringInitial toolbar position.
$heightintInitial drawer height percentage.

Returns

string: Rendered toolbar custom element.

public function scriptTag(): string

Renders a script tag for the Yii3-published toolbar runtime.

Returns

string: Toolbar runtime script tag.