Settings and quick start hooks
This page lists the 19 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.
adba_admin_presetsadba_field_typesadba_register_fieldsadba_role_default_modeadba_settings_card_sectionadba_settings_card_widthadba_settings_importedadba_settings_indexadba_settings_merged_tabsadba_settings_panel_keysadba_settings_savedadba_settings_schemaadba_settings_sectionsadba_settings_tabsadba_setup_linksadba_setup_presetsadba_setup_stepsadba_setup_woocommerce_cardsadba_user_prefs
adba_admin_presets
FilterSince 2.18.0 Runs in src/Setup/AdminPresets.php.
Filters the admin presets of the quick start. Add a preset or change one: each is an array with label, description, preview (labels), role_modes (role => advanced|simple|focus), role_profiles (role => profile of the simple view, since 2.24.0), simple (type => item => visible in every profile of the simple view) and hidden (type => item => roles it is hidden for).
| Argument | Type | Description |
|---|---|---|
$presets | array<string, array<string, mixed>> | Presets by id. |
add_filter( 'adba_admin_presets', function ( $presets ) {
return $presets;
} );
adba_field_types
FilterSince 1.3.0 Runs in src/Settings/Schema.php.
Filters the complete list of field types after registration.
Items that are not a FieldInterface are ignored. The text type always exists, as the fallback for unknown types.
| Argument | Type | Description |
|---|---|---|
$fields | array<string, FieldInterface> | Field types keyed by type. |
add_filter( 'adba_field_types', function ( $fields ) {
return $fields;
} );
adba_register_fields
ActionSince 1.3.0 Runs in src/Settings/Schema.php.
Fires when the settings schema is created, before any schema is normalised.
Call $schema->register_field( new My_Field() ) to add a field type. Registering a type that already exists replaces it: the last registration wins.
| Argument | Type | Description |
|---|---|---|
$schema | Schema | The schema service. |
add_action( 'adba_register_fields', function ( $schema ) {
// ...
} );
adba_role_default_mode
FilterSince 2.6.0 Runs in src/Settings/Prefs.php.
Filters the default view of a user who has not chosen one: advanced, simple or focus. The value is the role default set in Addofy > Appearance, or null when none applies. Return null to use the site default. The user's own choice always wins.
| Argument | Type | Description |
|---|---|---|
$mode | string|null | Role default view, or null. |
$user_id | int | User id. |
add_filter( 'adba_role_default_mode', function ( $mode, $user_id ) {
return $mode;
}, 10, 2 );
adba_settings_card_section
FilterSince 2.4.0 Runs in src/Modules/Settings/ModulesTab.php.
Filters the section a module card sits in on the Modules tab.
| Argument | Type | Description |
|---|---|---|
$section | string | Section id, see adba_settings_sections. |
$module_id | string | Module id. |
add_filter( 'adba_settings_card_section', function ( $section, $module_id ) {
return $section;
}, 10, 2 );
adba_settings_card_width
FilterSince 1.2.0 Runs in src/Modules/Settings/ModulesTab.php.
Filters the width of a module card on the Modules tab.
| Argument | Type | Description |
|---|---|---|
$width | string | 'full' for the whole row, '' for the three-column grid. |
$module_id | string | Module id. |
add_filter( 'adba_settings_card_width', function ( $width, $module_id ) {
return $width;
}, 10, 2 );
adba_settings_imported
ActionSince 1.3.0 Runs in src/Settings/Transfer.php.
Fires after an import was applied, from the Tools tab or from wp adba settings import.
Extension settings live under settings.module_settings, so they are part of the payload.
| Argument | Type | Description |
|---|---|---|
$payload | array<string, mixed> | Applied payload: settings, visibility, menu. |
$diff | array<int, array{area: string, label: string, change: string}> | What changed, as shown in the preview. |
$skipped | string[] | Setting keys fixed by a constant or environment variable. |
add_action( 'adba_settings_imported', function ( $payload, $diff, $skipped ) {
// ...
}, 10, 3 );
adba_settings_index
FilterSince 2.30.0 Runs in src/Modules/Settings/SettingsIndex.php.
Filters the entries of the settings search (settings page and command palette).
Add an entry for a setting of your own tab so the search finds it. Each entry is an array with key (config key or ''), label, description, place (tab or module name) and url (admin URL, with #id of the row to mark it). Entries without a label or url are dropped.
| Argument | Type | Description |
|---|---|---|
$entries | array<int, array<string, string>> | Entries. |
add_filter( 'adba_settings_index', function ( $entries ) {
return $entries;
} );
adba_settings_merged_tabs
FilterSince 2.30.0 Runs in src/Modules/Settings/Page.php.
Filters which settings tabs show inside another tab, as tab id => host tab id.
Views shows in Visibility (Access) by default. Remove an entry to give a tab its own place in the tab bar again. Entries whose tab or host does not exist are ignored, and a host cannot be merged itself.
| Argument | Type | Description |
|---|---|---|
$merged | array<string, string> | Tab id => host tab id. |
add_filter( 'adba_settings_merged_tabs', function ( $merged ) {
return $merged;
} );
adba_settings_panel_keys
FilterSince 2.30.0 Runs in src/Modules/Settings/PrefsTab.php.
Filters which settings of the Appearance tab show in the panel of a module instead.
Map a config key of this tab to a module id to move it into that module's panel (Modules tab, Settings), or remove a key to show it on the Appearance tab again. Storage does not change.
| Argument | Type | Description |
|---|---|---|
$keys | array<string, string> | Config key => module id. |
add_filter( 'adba_settings_panel_keys', function ( $keys ) {
return $keys;
} );
adba_settings_saved
ActionSince 1.3.0 Runs in src/Modules/Settings/Page.php.
Fires after a settings tab saved, before the redirect.
| Argument | Type | Description |
|---|---|---|
$tab_id | string | Tab id, for example general or modules. |
$input | array<string, mixed> | Submitted values (the adba[] fields, unslashed), each value passed through sanitize_text_field() (since 2.34.1); the tab itself sanitises per field. |
$done | array<string, mixed> | What the tab returned: notice, args and an optional redirect. |
add_action( 'adba_settings_saved', function ( $tab_id, $input, $done ) {
// ...
}, 10, 3 );
adba_settings_schema
FilterSince 1.0.0 Runs in src/Modules/Settings/ModulesTab.php.
Filters the settings schema of a module.
| Argument | Type | Description |
|---|---|---|
$schema | array<string, array<string, mixed>> | Field definitions. |
$module_id | string | Module id. |
add_filter( 'adba_settings_schema', function ( $schema, $module_id ) {
return $schema;
}, 10, 2 );
adba_settings_sections
FilterSince 2.4.0 Runs in src/Modules/Settings/ModulesTab.php.
Filters the sections of the Modules tab. Add a section here, then place modules in it with adba_settings_card_section. The Other section is always added last.
| Argument | Type | Description |
|---|---|---|
$sections | array<string, string> | Section id => label, in display order. |
add_filter( 'adba_settings_sections', function ( $sections ) {
return $sections;
} );
adba_settings_tabs
FilterSince 1.3.0 Runs in src/Modules/Settings/Page.php.
Filters the tabs of the Addofy settings page.
Add a TabInterface instance (extend AbstractTab) to add a tab, reorder the array to move tabs, or use the id of a built-in tab (modules, visibility, menu, preferences, tools) to replace it. Items that are not a TabInterface or have an id other than lowercase letters, digits, – and _ are ignored. Built-in tabs cannot be removed. Addofy adds the submenu entry, the capability check and the nonce check.
| Argument | Type | Description |
|---|---|---|
$tabs | array<string, TabInterface> | Tabs keyed by id, in display order. |
add_filter( 'adba_settings_tabs', function ( $tabs ) {
return $tabs;
} );
adba_setup_links
FilterSince 1.1.0 Runs in src/Setup/Steps/Done.php.
Filters the quick links on the last step of the quick start.
| Argument | Type | Description |
|---|---|---|
$links | array<int, array{icon: string, title: string, text: string, url: string, module?: string}> | Links in order. |
add_filter( 'adba_setup_links', function ( $links ) {
return $links;
} );
adba_setup_presets
FilterSince 1.1.0 Runs in src/Setup/ModulePresets.php.
Filters the module presets of the quick start.
| Argument | Type | Description |
|---|---|---|
$presets | array<string, array{label: string, description: string, modules: array<string, bool>}> | Presets by id. |
$modules | array<string, ModuleInterface> | Modules the presets switch. |
add_filter( 'adba_setup_presets', function ( $presets, $modules ) {
return $presets;
}, 10, 2 );
adba_setup_steps
FilterSince 1.1.0 Runs in src/Setup/StepRegistry.php.
Filters the quick start steps. Add a StepInterface to add a step; order is kept.
| Argument | Type | Description |
|---|---|---|
$steps | StepInterface[] | Steps in order. |
add_filter( 'adba_setup_steps', function ( $steps ) {
return $steps;
} );
adba_setup_woocommerce_cards
FilterSince 2.36.0 Runs in src/Setup/Steps/WooCommerce.php.
Filters the modules the WooCommerce step of the quick start switches. Add the id of your module to give it a card in that step; it then leaves the list of the Modules step.
| Argument | Type | Description |
|---|---|---|
$ids | string[] | Module ids in display order. |
$modules | array<string, \AddoBack\Modules\ModuleInterface> | Modules the quick start can switch. |
add_filter( 'adba_setup_woocommerce_cards', function ( $ids, $modules ) {
return $ids;
}, 10, 2 );
adba_user_prefs
FilterSince 1.3.0 Runs in src/Settings/Prefs.php.
Filters the user preferences that extensions add, as key => array( 'values' => …, 'default' => … ).
The values entry is 'bool' or a list of allowed strings (lowercase letters, digits, – and _). The key needs a prefix of your plugin, like myplugin_layout; keys without one, and Addofy's own keys, are ignored. Registered keys are stored in the adba_prefs user meta and work with adba.prefs.get() and adba.prefs.set() in JavaScript.
| Argument | Type | Description |
|---|---|---|
$prefs | array<string, array<string, mixed>> | Preference definitions keyed by preference key. |
add_filter( 'adba_user_prefs', function ( $prefs ) {
return $prefs;
} );