Clanbite Since 1.4.0 Updated in 1.5.0
clanbite_register_admin_sub_tab( string $tab_id, array $args ): voidAdd 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.
Parameters
$tab_id(string) RequiredTab id, exactly as in the tab descriptor:
general,extensions,core-groups,ext-{extension_slug}, or an integration tab id added throughclanbite_admin_rest_tabs.$args(array<string, mixed>) RequiredSub-tab definition.
$idstringRequired. Unique id within the tab (a-z0-9_-); used as theviewquery value.$labelstringRequired. Translated label shown in the sub-navigation.$slotIdstringIdentifier for the container your script mounts into (a-z0-9_-). Required unless you passsectionGroups.$sectionGroupsarrayOptional alternative toslotId: settings the admin screen renders itself, so no script is needed. Each group haskind(primary),name,slug,optionKeyandsections(the shape of\Kernowdev\Clanbite\Extensions\Abstract_Settings::export_rest_schema()); the option must be registered throughclanbite_admin_rest_settings_registry.$capabilitystringOptional. Capability required to see the entry. Defaultmanage_options.$priorityintOptional. Lower numbers come first. Default 10.
Returns
void
Defined in inc/admin/functions.php
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Updated. |
| 1.4.0 | Introduced. |