ToolbarDataFactory
API reference › Yii3 Debug › ToolbarDataFactory
Creates toolbar data from framework metadata and captured extension panels.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a toolbar-data factory with asset URL and debugger route configuration. | ToolbarDataFactory |
create() | Builds the toolbar chrome for a capture, without its panels. | ToolbarDataFactory |
createForSnapshot() | Builds the complete toolbar payload for a capture, panels included. | ToolbarDataFactory |
withExtensionPanels() | Returns a copy carrying the extension panels shown on the toolbar. | ToolbarDataFactory |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(Yiisoft\Assets\AssetManager $assetManager, Yii3\Debug\Middleware\ToolbarOptions $options = new \Yii3\Debug\Middleware\ToolbarOptions())Creates a toolbar-data factory with asset URL and debugger route configuration.
Parameters
| Parameter | Type | Description |
|---|---|---|
$assetManager | Yiisoft\ | Manager resolving the published URLs of the toolbar assets. |
$options | Yii3\ | Settings carrying the route prefix every debugger URL is built on and the toolbar presentation. |
create()
Section titled “create() ”public function create(string $tag): PHPForge\Debug\Toolbar\ToolbarDataBuilds the toolbar chrome for a capture, without its panels.
Parameters
| Parameter | Type | Description |
|---|---|---|
$tag | string | Tag of the capture the toolbar links to. |
Returns
ToolbarData: Toolbar payload carrying navigation, presentation, and branding.
createForSnapshot()
Section titled “createForSnapshot() ”public function createForSnapshot(PHPForge\Debug\Storage\DebugSnapshot $snapshot): PHPForge\Debug\Toolbar\ToolbarDataBuilds the complete toolbar payload for a capture, panels included.
Parameters
| Parameter | Type | Description |
|---|---|---|
$snapshot | PHPForge\ | Capture the toolbar describes. |
Returns
ToolbarData: Toolbar payload including every registered extension panel.
withExtensionPanels()
Section titled “withExtensionPanels() ”public function withExtensionPanels(iterable<Yii3\Debug\Panel\ExtensionPanelInterface> $extensionPanels): selfReturns a copy carrying the extension panels shown on the toolbar.
Chips follow the order given, which is the order the sidebar lists the same panels in: the container passes
ExtensionRegistry::panelsWithBuiltIns(), built-ins first in BuiltInPanels::IDS order.
Parameters
| Parameter | Type | Description |
|---|---|---|
$extensionPanels | iterable<Yii3\> | Optional extension presenters in toolbar order. |
Returns
self: Factory with the panels applied.
Throws
InvalidArgumentException: when a panel ID is empty or duplicated.