# clanbite_register_admin_sub_tab()

Add an entry to the sub-navigation of any tab on the Clanbite settings screen.

Every tab (General, Extensions, an extension's own tab, an integration tab) can carry a small sub-menu such as
"Settings | Manage members". The first entry is always the tab's own content; each entry you register adds a
view next to it. Several plugins may register on the same tab; entries are ordered by `priority`.

The view is rendered by your own JavaScript: core prints an empty container and fires the DOM events
`clanbite:admin-integration-mount` and `clanbite:admin-integration-unmount` on it with
`event.detail.slotId` set to your `slotId` (see README, "Admin sub-navigation"). The events can fire more
than once for the same element, so mount idempotently.

The active view is kept in the URL as `admin.php?page=clanbite&tab={tab_id}&view={id}`.

Call this before the admin REST bootstrap is built (any time on `plugins_loaded` or `init` is fine). It is a
thin wrapper around the `clanbite_admin_rest_sub_tabs` filter, which you can use directly when you need the
tab descriptor.

```php
clanbite_register_admin_sub_tab( string $tab_id, array $args ): void
```

## Parameters

- `$tab_id` (string) Tab id, exactly as in the tab descriptor: `general`, `extensions`, `core-groups`, `ext-{extension_slug}`, or an integration tab id added through `clanbite_admin_rest_tabs`.
- `$args` (array<string, mixed>) Sub-tab definition.
  - `$id` (string) Required. Unique id within the tab (`a-z0-9_-`); used as the `view` query value.
  - `$label` (string) Required. Translated label shown in the sub-navigation.
  - `$slotId` (string) Identifier for the container your script mounts into (`a-z0-9_-`). Required unless you pass `sectionGroups`.
  - `$sectionGroups` (array) Optional alternative to `slotId`: settings the admin screen renders itself, so no script is needed. Each group has `kind` (`primary`), `name`, `slug`, `optionKey` and `sections` (the shape of `\Kernowdev\Clanbite\Extensions\Abstract_Settings::export_rest_schema()`); the option must be registered through `clanbite_admin_rest_settings_registry`.
  - `$capability` (string) Optional. Capability required to see the entry. Default `manage_options`.
  - `$priority` (int) Optional. Lower numbers come first. Default 10.

## Return

`void` 

## Changelog

| Version | Description |
| --- | --- |
| 1.5.0 | Updated |
| 1.4.0 | Introduced |
