# White Label

The `sleekwp/whiteLabel` filter replaces SleekWP's branding in the standalone
plugins: the admin menu, the product's name and logo in the app, and the
License page. Every standalone SleekWP plugin reads the same filter, so one
configuration covers all of them. Keep it
in a custom plugin or a must-use plugin, so it stays active when the theme
changes and is not overwritten by plugin updates.

White label applies to standalone plugins only. The SleekOS suite keeps its
own **SleekOS** menu and branding whatever the filter returns.

## Example configuration

```php
<?php
/**
 * Plugin Name: Site Branding
 */

add_filter( 'sleekwp/whiteLabel', function (): array {
	return array(
		'enabled' => true,
		'app'     => array(
			'type'  => 'parts',
			'logo'  => array(
				'total' => array( 'logoUrl' => 'https://example.com/brand/logo.svg' ),
				'parts' => array( 'logoUrl' => 'https://example.com/brand/mark.svg' ),
			),
			'names' => array(
				'total' => array(
					'plugins' => array(
						'ai'    => 'Acme Assistant',
						'track' => 'Acme Analytics',
						'view'  => 'Acme Data',
					),
				),
				'parts' => array(
					// The prefix and the product name are joined as they are,
					// so end the prefix with a space.
					'prefix'  => 'Acme ',
					'plugins' => array(
						'ai'    => 'Assistant',
						'track' => 'Analytics',
						'view'  => 'Data',
					),
				),
			),
		),
		'wp'      => array(
			'admin' => array(
				'menu' => array(
					'parent'  => array(
						'text' => 'Acme Tools',
						'icon' => base64_encode( '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" d="M3 3h14v14H3z"/></svg>' ),
					),
					'plugins' => array(
						'ai'    => 'Assistant',
						'track' => 'Analytics',
						'view'  => 'Data',
					),
				),
			),
		),
	);
} );
```

## The enabled key

The product's name, its logo and the hidden **License** page change only
while `enabled` is exactly `true`; with any other value, or without it, they
stay as they are. The admin menu's `wp.admin.menu` keys apply either way, as
they did in the released plugins. To turn white labelling off, return `false`
there and leave out the menu keys, or remove the filter.

While it is `true`, every standalone plugin hides its **License** page. Activate
each product's license with its `SLEEK_<PRODUCT>_LICENSE` constant instead, as
that product's **Activating** page describes.

## Product keys

The maps below are keyed by the product's key: `ai`, `byte`, `lang`, `link`,
`log`, `mail`, `motion`, `pixel`, `rank`, `sweep`, `track` and `view`. A
product missing from a map keeps its own value for that part.

## The admin menu

Standalone plugins share one **SleekWP** menu in the WordPress admin, with one
entry per product.

| Key                           | Changes                                                       | Without it                                 |
| ----------------------------- | ------------------------------------------------------------- | ------------------------------------------ |
| `wp.admin.menu.parent.text`   | the shared menu's label                                       | **SleekWP**                                |
| `wp.admin.menu.parent.icon`   | the shared menu's icon: the base64-encoded contents of an SVG | the SleekWP icon                           |
| `wp.admin.menu.plugins.<key>` | the product's entry in that menu                              | the product's own label, such as **Track** |

The shared menu is created by the first standalone plugin that loads, so with
several installed, the label and icon it was created with are the ones shown.

## The app

| Key                                                          | Changes                                                                | Without it                                     |
| ------------------------------------------------------------ | ---------------------------------------------------------------------- | ---------------------------------------------- |
| `app.type`                                                   | how the product's name is built: `parts` or `total`                    | `total`                                        |
| `app.names.total.plugins.<key>`                              | in `total` mode, the product's whole name                              | the product's label, such as **Track**         |
| `app.names.parts.prefix` and `app.names.parts.plugins.<key>` | in `parts` mode, the name is the prefix followed directly by the entry | the product's label, when the entry is missing |
| `app.logo.total.logoUrl` or `app.logo.parts.logoUrl`         | the logo in the app's sidebar header, for the mode in use              | the default logo                               |

The name appears beside the logo in the app's sidebar header. A logo must be
an absolute `http` or `https` address; anything else keeps the default logo.
The same logo is used in the light and the dark theme, so choose one that reads
on both.

Colours are not white-labelled: an `app.colors` entry, which earlier
standalone versions read, is ignored.

## Deployment notes

- Use an HTTPS logo address that every administrator can load.
- Keep the SVG source of the menu icon in version control before encoding it.
- White labelling changes presentation only; licenses, updates, capabilities
  and plugin behaviour stay the same.

## For developers

The [hooks reference](../hooks.md#function-sleekos-standalone-whitelabel-current)
describes the filter as the standalone shell reads it.
