# Hooks

<!-- Generated by `pnpm docs:reference`. Do not edit this file; change the code it is read from. -->

SleekPixel fires these hooks for site code. Each is documented by the `@api` docblock on the `apply_filters` or `do_action` call that fires it; a hook without one is internal and may change without notice.

## `sleekPixel/buffer/output`

Filter, fired in `product/includes/classes/Output.php`.

Filters the front-end page HTML Pixel buffers from `wp_head` to `wp_footer`, after Pixel has written its Open Graph and Twitter Card image tags into it. It does not run in the admin or the Customizer preview.

| Parameter | Type | Description |
| --- | --- | --- |
| `$html` | `string` | The buffered page HTML. |

**Returns** string The HTML to send.

## `sleekPixel/conditions`

Filter, fired in `product/includes/classes/Data.php`.

Adds conditions to the Conditions view of every image, listed by their label. A condition is an array with an `id`, a `label` and a `value` that is a boolean or a string, computed for the current request. A condition whose `id` starts with `is` or `has` is boolean and matches on a `true` or `false` value; any other compares its value with the text entered in the row. The editor stores the row as `custom_` followed by the ID passed through sanitize_key(), so an ID in lowercase letters, digits, `_` and `-` matches on the front end.

| Parameter | Type | Description |
| --- | --- | --- |
| `$conditions` | `array<int,array{id:string,label:string,value:bool\|string}>` | The custom conditions, empty by default. |

**Returns** array<int,array{id:string,label:string,value:bool\|string}> The custom conditions.

## `sleekPixel/data`

Filter, fired in `product/includes/classes/Data.php`.

Filters the dynamic data an image reads for one post before its elements resolve their placeholders: the `post`, `author`, `site`, `archive`, `query`, `object` and `custom` groups.

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `array<string,mixed>` | The dynamic data, keyed by group. |
| `$args` | `array<string,mixed>` | The `postId` being rendered and, when an image design renders, its `settings`, `elements`, `other` and `locations`. |

**Returns** array<string,mixed> The dynamic data.

## `sleekPixel/data/custom`

Filter, fired in `product/includes/classes/Data.php`, `product/includes/classes/Image/Elements/Element.php`.

Adds entries to the Custom group of the editor's dynamic data, each usable as `{custom.<value>}` in an element. An entry is an array with a `value` (its ID), a `label` (its name in the editor) and the string `data` the image shows; an entry missing any of the three, or whose `data` is null, is ignored when an image renders. The editor builds its list with `postId` 0.

| Parameter | Type | Description |
| --- | --- | --- |
| `$entries` | `array<int,array{value:string,label:string,data:string}>` | The custom entries, empty by default. |
| `$args` | `array<string,mixed>` | The `postId` being rendered; the call that builds an element's dynamic data also passes the image design's `settings`, `elements`, `other` and `locations`. |

**Returns** array<int,array{value:string,label:string,data:string}> The custom entries.

## `sleekPixel/fonts/defaultDirectory`

Filter, fired in `product/includes/classes/Fonts.php`.

Filters the folder holding the bundled Inter font files that the designer's Default font is built from.

| Parameter | Type | Description |
| --- | --- | --- |
| `$path` | `string` | The folder, without a trailing slash. |

**Returns** string The folder to read the Inter files from.

## `sleekPixel/image/element/data`

Filter, fired in `product/includes/classes/Image/Elements/Element.php`.

Filters one element of an image design before it renders: its `type` (`text`, `image` or `section`), its `data` (content, colours, source) and its `styles` (position, size, typography).

| Parameter | Type | Description |
| --- | --- | --- |
| `$elementData` | `array<string,mixed>` | The element as the design stores it. |
| `$image` | `array<string,mixed>\|null` | The image design being rendered, with its `settings`, `elements`, `other` and `locations`. |

**Returns** array<string,mixed> The element to render.

## `sleekPixel/init`

Action, fired in `product/includes/classes/Plugin.php`.

Fires once after Pixel has booted: its post types, shortcode and WP-CLI commands are registered and, when the Imagick extension is available, its front-end output and REST operations too.

| Parameter | Type | Description |
| --- | --- | --- |
| `$plugin` | `\SleekPixel\Plugin` | The booted Pixel instance, also returned by sleekPixel(). |
