ITC Forms 0.15.6Changelog
JavaScript hooks
The builder uses @wordpress/hooks. Register filters through wp.hooks from a
dependency that loads before itc-forms-admin or the form editor bundle.
JavaScript is an editor aid only; PHP remains authoritative.
Typed descriptors and validators are exported from
src/blocks/form/extensions.ts. The stable browser API version is 1.0.0.
itcForms.block.themeTokens
Section titled “itcForms.block.themeTokens”Receives an immutable semantic token record, the current appearance mode, and
the extension API version. It changes only the editor preview. Pair it with the
authoritative itc_forms_block_theme_tokens PHP filter for frontend parity;
the JavaScript hook cannot change validation, submission behavior, or server
data. Unknown keys and unsafe values are ignored. See
Form design tokens for the stable map and examples.
itcForms.builder.fieldTypes
Section titled “itcForms.builder.fieldTypes”Receives an immutable record of built-in field descriptors. Return a new
record with custom descriptors. Built-ins cannot be replaced and malformed
entries are ignored. A descriptor contains key, label, control,
inputType, and supported operators. A matching PHP field registration is
required; see custom field types.
itcForms.fieldTypeIcon
Section titled “itcForms.fieldTypeIcon”Receives the WordPress icon element selected for a field-library tile and its
validated field descriptor. Return a React element to replace the icon for a
custom field type. The icon is decorative and rendered with aria-hidden; the
visible field label remains the accessible name. Unknown field types receive a
neutral code icon, so an extension never falls back to a misleading initial.
wp.hooks.addFilter( 'itcForms.fieldTypeIcon', 'acme/company-field-icon', ( icon, field ) => field.key === 'company_code' ? wp.element.createElement( 'svg', { viewBox: '0 0 24 24', focusable: 'false' }, wp.element.createElement( 'path', { d: 'M4 4h16v16H4z' } ) ) : icon);itcForms.builder.settings
Section titled “itcForms.builder.settings”Receives immutable builder setting descriptors. Return a validated subset or reordering to adjust labels and control sizes. It cannot create new persisted settings or bypass the REST schema.
For a small companion plugin, load an inline registration before the admin bundle:
add_action( 'admin_enqueue_scripts', function (): void { $script = <<<'JS'wp.hooks.addFilter( 'itcForms.builder.settings', 'acme/forms-settings', ( settings ) => settings.map( ( setting ) => setting.key === 'description' ? { ...setting, label: 'Introduction', rows: 5 } : setting ));JS; wp_add_inline_script( 'itc-forms-admin', $script, 'before' );} );Namespace every callback (vendor/plugin-feature) and return new objects
instead of mutating the immutable defaults. Test the Gutenberg editor and the
standalone Forms builder after every extension change.
Reordering boundary
Section titled “Reordering boundary”Field reordering is deliberately not a JavaScript hook or persisted extension
point. The internal drag adapter can emit only { fieldUid, targetUid, position }; the builder owns schema-preserving movement, history, selection,
focus, announcements, and saving. Companion plugins must not attach sortable
state to form definitions or replace the button and keyboard movement paths.
Other stable builder registries
Section titled “Other stable builder registries”itcForms.builder.conditionOperators: paired condition evaluators.itcForms.builder.feedProviders: UI metadata for PHP-registered providers.itcForms.builder.challengeProviders: reorders or relabels only the server-registered challenge choices. Availability and privacy guidance remain server/core-owned, missing choices are restored, and PHP validates the saved key again.itcForms.builder.panels: PHP-paired inspector panels.itcForms.builder.slotFills: fills for the documented builder slots.
Builder fills are additive. The stable semantic locations are canvas toolbar,
selected-field actions, field-library groups, launch readiness, confirmation
and workflow configuration, automation list and provider configuration,
builder notices, and footer. Display-only contexts contain safe summaries and
no mutation function. Configuration fills may persist only through the
provided setExtensionValue() function, which is restricted to controls in a
PHP-registered form-extension namespace. Core retains drag/reorder, focus,
history, save concurrency, validation, and REST normalization.
Use the builder_spam_protection_after slot for provider-specific editor help
or safe controls adjacent to the authoritative challenge-provider selection.
Frontend code may observe the itcforms:recaptcha CustomEvent; its detail is
limited to provider, mode, state, and the public form key. Tokens, keys,
scores, hostnames, and provider responses are deliberately excluded.
The lifecycle states are load_requested, ready, token_ready, expired,
error, and destroyed. A consent loader may defer the Google script, listen
for load_requested, and release the already-enqueued script after consent;
the form client waits for the API and remains retryable if loading fails. The
event is observational and cannot bypass server-side challenge verification.
See Extension API 1.0 for descriptor signatures, examples, security boundaries, action hooks, UI slots, and deprecation policy.
itcForms.builder.fieldRenderers registers React components by field type in
both editors. See extension recipes for component props.