# SortHeader

> Represents the header cell of a sortable column, pairing the rendered sort link with the announced order.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [View](/docs/extensions/debug-core/reference/view/index.md) › [Grid](/docs/extensions/debug-core/reference/view/grid/index.md) › SortHeader

| final readonly class | `PHPForge\Debug\View\Grid\SortHeader` |
| --- | --- |
| Implements | [`Stringable`](https://www.php.net/manual/en/class.stringable.php) |
| Source | [`src/View/Grid/SortHeader.php`](https://github.com/php-forge/debug-core/blob/main/src/View/Grid/SortHeader.php#L12) |

Represents the header cell of a sortable column, pairing the rendered sort link with the announced order.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-attributes"></span>`$attributes` readonly constructor | `array<string, string>` | Header cell attributes announcing the active order, empty while the rows are ordered by another attribute. Default: `[]`. | `SortHeader` |
| <span id="property-link"></span>`$link` readonly constructor | `string` | Rendered link requesting the order of the next click. | `SortHeader` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a sortable-column header with its announced order. | `SortHeader` |
| [`__toString()`](#method-__toString) | Returns the rendered sort link of the header cell. | `SortHeader` |

## Method details

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

```php
public function __construct(string $link, array<string, string> $attributes = [])
```

Creates a sortable-column header with its announced order.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$link` | `string` | Rendered link requesting the order of the next click. |
| `$attributes` | `array<string, string>` | Header cell attributes announcing the active order, empty while the rows are ordered by another attribute. |

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

```php
public function __toString(): string
```

Returns the rendered sort link of the header cell.

**Returns**

`string`: Rendered link.