# SidebarDataNormalizer

> Builds the Debug Core sidebar view-model used by history and request views, with every route already resolved through yii\helpers\Url::to().

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › [widgets](/docs/extensions/debug/reference/widgets/index.md) › [sidebar](/docs/extensions/debug/reference/widgets/sidebar/index.md) › SidebarDataNormalizer

| final class | `yii\debug\widgets\sidebar\SidebarDataNormalizer` |
| --- | --- |
| Source | [`src/widgets/sidebar/SidebarDataNormalizer.php`](https://github.com/yii2-extensions/debug/blob/main/src/widgets/sidebar/SidebarDataNormalizer.php#L32) |

Builds the Debug Core sidebar view-model used by history and request views, with every route already resolved
through [`Url::to()`](/docs/api/yii/helpers/baseurl/index.md#method-to).

- `fromView(...)` used by panel `view` requests; surfaces the active request snapshot and highlights the active panel
  in the nav.
- `fromIndex(...)`used by `index` requests; surfaces the newest captured request and highlights the History entry.
- `fromStandalone(...)` used by pages outside any capture, such as phpinfo; highlights nothing.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`fromIndex()`](#method-fromIndex) static | Builds the sidebar view-model for `index.php` (history grid). Surfaces the newest captured request as the snapshot, marks the History entry as active, and wires the navigator buttons as a GridView cursor. | `SidebarDataNormalizer` |
| [`fromStandalone()`](#method-fromStandalone) static | Builds the sidebar view-model for a standalone debugger page such as phpinfo. | `SidebarDataNormalizer` |
| [`fromView()`](#method-fromView) static | Builds the sidebar view-model for panel `view` requests. Surfaces the active request snapshot and highlights the active panel in the nav. | `SidebarDataNormalizer` |

## Method details

### fromIndex() <span id="method-fromIndex"></span>

```php
public static function fromIndex(array<string, yii\debug\Panel> $panels, array<string, PHPForge\Debug\Storage\RequestSummary> $manifest, string $cursorInit = ''): PHPForge\Debug\View\Sidebar\SidebarView
```

Builds the sidebar view-model for `index.php` (history grid). Surfaces the newest captured request as the
snapshot, marks the History entry as active, and wires the navigator buttons as a GridView cursor.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$panels` | `array<string,` [`yii\debug\Panel`](/docs/extensions/debug/reference/panel/index.md)`>` | Registered panels keyed by ID. |
| `$manifest` | `array<string, PHPForge\Debug\Storage\RequestSummary>` | Captured request summaries, newest first. |
| `$cursorInit` | `string` | Tag the cursor should land on; empty to start at the newest capture. |

**Returns**

`PHPForge\Debug\View\Sidebar\SidebarView`: Sidebar view-model for the history grid.

### fromStandalone() <span id="method-fromStandalone"></span>

```php
public static function fromStandalone(array<string, yii\debug\Panel> $panels, array<string, PHPForge\Debug\Storage\RequestSummary> $manifest): PHPForge\Debug\View\Sidebar\SidebarView
```

Builds the sidebar view-model for a standalone debugger page such as phpinfo.

The page belongs to no capture and to no panel, so the navigation highlights nothing and the snapshot card
surfaces the newest capture, keeping the reader one click from the panels.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$panels` | `array<string,` [`yii\debug\Panel`](/docs/extensions/debug/reference/panel/index.md)`>` | Registered panels keyed by ID. |
| `$manifest` | `array<string, PHPForge\Debug\Storage\RequestSummary>` | Captured request summaries, newest first. |

**Returns**

`PHPForge\Debug\View\Sidebar\SidebarView`: Sidebar view-model for the standalone page.

### fromView() <span id="method-fromView"></span>

```php
public static function fromView(array<string, yii\debug\Panel> $panels, array<string, PHPForge\Debug\Storage\RequestSummary> $manifest, yii\debug\Panel $activePanel, string $tag, PHPForge\Debug\Storage\RequestSummary $summary): PHPForge\Debug\View\Sidebar\SidebarView
```

Builds the sidebar view-model for panel `view` requests. Surfaces the active request snapshot and highlights the
active panel in the nav.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$panels` | `array<string,` [`yii\debug\Panel`](/docs/extensions/debug/reference/panel/index.md)`>` | Registered panels keyed by ID. |
| `$manifest` | `array<string, PHPForge\Debug\Storage\RequestSummary>` | Captured request summaries, newest first. |
| `$activePanel` | [`yii\debug\Panel`](/docs/extensions/debug/reference/panel/index.md) | Panel being inspected, highlighted in the navigation. |
| `$tag` | `string` | Tag of the capture under inspection. |
| `$summary` | `PHPForge\Debug\Storage\RequestSummary` | Summary of the capture under inspection. |

**Returns**

`PHPForge\Debug\View\Sidebar\SidebarView`: Sidebar view-model for the panel view.