Hooks

AdminUi

3 hooks fired by AdminUi: 2 filters and 1 actions across 3 call sites.

3 hooks fired by AdminUi: 2 filters and 1 actions across 3 call sites. 3 of the 3 call sites are described by a docblock, at the call or on the constant that names the hook; the rest are listed with their signature and call sites only. Paths are relative to the plugin directory.

wp_react_settings_${type}_control_content

Filter · Dynamic name · 3 arguments · 1 call site

Filters the rendered content of a settings control the built-in set does not cover.

The variable part of the name is the field's type, so registering a custom control means adding a filter named after the type you put in the settings structure — wp_react_settings_colour_picker_control_content for type: 'colour_picker'.

Return a React element to render it. Returning the empty default leaves a warning notice in its place naming the unknown type, so a screen never silently drops a field.

applyFilters( `wp_react_settings_${type}_control_content`, '', fieldProps, { sharedData, renderNotification, onSave, } )
  • content (string|Object) — Rendered control. Default ''.
  • fieldProps (Object) — The field's props, including value and onChange.
  • helpers (Object) — { sharedData, renderNotification, onSave }.

Fired from:

  • assets/packages/admin-ui/settings/controls/Control.js:328

wp_react_settings_shared_context_init

Action · 2 arguments · 1 call site

Fires on every render of the settings screen's shared data store.

The store is the one piece of state every control on a settings screen can read and write, which is how one field reacts to another's value. This runs during render, not in an effect, so a listener must not call setState unconditionally — that loops. Guard on the value you are about to write.

doAction( 'wp_react_settings_shared_context_init', state, setState )
  • state (Object) — Current shared data.
  • setState (Function) — React state setter for it.

Fired from:

  • assets/packages/admin-ui/settings/SharedDataStore/Provider.js:19

wp_react_settings_shared_context_initial_values

Filter · 1 argument · 1 call site

Filters the shared data store's starting value.

Runs once, before the settings app mounts, so it is where an add-on seeds the state its own controls read on first render. After mount the store is changed through setData instead.

applyFilters( `wp_react_settings_shared_context_initial_values`, {} )
  • values (Object) — Initial shared data. Default {}.

Fired from:

  • assets/packages/admin-ui/settings/index.js:41

On this page