# Hooks

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

SleekView 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.

## `sleekView/dataSourcePresets`

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

Filters the data source presets a View's Data Source field offers beside its built-in source types. Choosing a preset sets the View's data source only. Each preset needs a `key`, a `label`, a `dataSource` array and a `type` that is one of the non-post-type source types; `group` (`integrations` or `custom`, the default) places it in the field, and `fetch` (`headers`, `timeout`, `redirection`) holds request settings for remote sources that stay on the server and never reach the browser.

| Parameter | Type | Description |
| --- | --- | --- |
| `$presets` | `array<int,array<string,mixed>>` | The presets so far: the WooCommerce table presets while WooCommerce is active and their tables exist, otherwise none. |

**Returns** array<int,array<string,mixed>> The presets to offer; an entry without a key, a label, a dataSource array or a supported type is dropped.

## `sleekView/init`

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

Fires once SleekView has booted and hooked up its REST routes, WP-CLI commands, shortcode, post types and admin page menus, so code that extends SleekView can run after it.

| Parameter | Type | Description |
| --- | --- | --- |
| `$plugin` | `\SleekView\Plugin` | The SleekView instance, which the sleekView() function also returns. |
