ITC Forms 0.15.6Changelog
PHP hooks
Administration pages, screens, and notices
Section titled “Administration pages, screens, and notices”Form and entry action registries execute only through core-owned POST controls.
Descriptors contain a namespaced key, plain-text label, validated
capability, and callback. Existing API 1.0
legacy slug keys remain accepted; new actions use vendor/name. Core reloads
the record and checks its revision after verifying the baseline capability,
descriptor capability, and tuple-specific nonce. The callback receives a safe
record summary plus at most 20 bounded plain-text input values—never entry
values—and returns exactly status, message, and mutated. Mutations append
a privacy-safe audit event. Invalid results and exceptions fail closed with a
current-user notice and redacted descriptor diagnostic.
Register an additive page with itc_forms_admin_page_registry. Keys use the
vendor/name form. A descriptor requires label, after, capability, and a
render callback; optional fields are menu_label, enqueue,
script_handles, style_handles, and contextual_help. after is one of the
stable core keys forms, builder, automations, entries, deliveries,
onboarding, settings, integrations, or tools. Core generates the page
slug and checks both form-editing access and the descriptor capability before
rendering, loading assets, or adding help.
Asset handles must already be registered with WordPress. They enqueue only on
the owning page. For additive contributions on a core screen, use
itc_forms_admin_screen_assets; its context contains only the stable key,
generated slug, is_core flag, and Extension API version. The action runs at
priority 20, after ITC Forms’ own screen enqueue callbacks, so registered
dependencies are available before an extension consumes a JavaScript hook.
Mutation callbacks remain responsible for their own capability check, action
nonce, input normalization, and safe redirect. Use
AdminNoticeStore::redirect_url( $screen_key, $type, $plain_text_message ) to
create a core-validated redirect carrying a current-user, five-minute,
single-use notice. Types are success, warning, error, or info; HTML and
unknown redirect destinations are rejected or reduced to bounded plain text.
add_filter( 'itc_forms_admin_page_registry', static function ( array $pages, string $api_version ): array { $pages['acme/reports'] = array( 'label' => __( 'CRM reports', 'acme-forms' ), 'after' => 'entries', 'capability' => 'acme_view_reports', 'render' => array( Acme_Reports_Page::class, 'render' ), 'script_handles' => array( 'acme-forms-reports' ), ); return $pages; }, 10, 2);Spam providers and assisted drafting
Section titled “Spam providers and assisted drafting”New challenge providers register with itc_forms_spam_provider_registry and a
vendor/name key. Version 1.0 descriptors declare a label, dynamic
availability, an allowlisted capability set (render, verify, privacy,
optional scripts and consent), token field allowlist, callbacks, privacy
disclosure, consent requirement, and optional load/teardown callbacks. A
consent-required loader is not invoked until render_challenge() receives an
explicit granted signal. Render
callbacks receive only the form key, provider key, and consent flag. Verify
callbacks receive one bounded scalar token and the form/provider keys—never raw
$_POST, another provider’s credentials, submitted values, or the complete
definition. Only strict valid === true passes; missing, malformed, throwing,
or unavailable providers fail closed. Reasons are sanitized identifiers capped
at 64 bytes. The legacy itc_forms_spam_challenge_providers registry remains
compatible for Extension API 1.x; new integrations should use the token-only
contract. The legacy registry is a deprecated compatibility bridge whose
callbacks still receive the historical definition and POST array; do not use it
for new providers.
Assisted drafting adapters register through itc_forms_ai_adapter_registry.
Version 1.0 descriptors declare a vendor/name key, capability, readiness
and either a registered ProviderSecretStore key or legacy
secret-configured callback, a 1–30 second timeout, privacy disclosure, and
one generate callback. Core bounds prompts to 2,000 characters, supplies only
locale/schema/timeout context, rate-limits each user and adapter, normalizes the
complete returned definition, and emits itc_forms_ai_draft_completed with
only adapter key, user ID, and field count. The disclosure is returned beside
the draft, elapsed time beyond the declared timeout fails closed, and failures
emit itc_forms_ai_draft_failed without prompts or responses. Credentials stay
in isolated server storage. itc_forms_ai_draft_definition is a deprecated bridge through
plugin 0.10.x and emits a development deprecation notice; migrate to the
registry before Extension API 2.0.
A mutation belongs in a dedicated admin_post controller. The page registry
does not authorize writes or verify nonces for an extension:
final class Acme_Reports_Action { public static function hooks(): void { add_action( 'admin_post_acme_refresh_report', array( self::class, 'handle' ) ); }
public static function handle(): void { $has_baseline = current_user_can( 'itc_forms_edit_forms' ) || current_user_can( 'manage_options' ); if ( ! $has_baseline || ! current_user_can( 'acme_manage_reports' ) ) { wp_die( esc_html__( 'You cannot refresh this report.', 'acme-forms' ), '', array( 'response' => 403 ) ); }
check_admin_referer( 'acme_refresh_report' ); $range = isset( $_POST['range'] ) && is_string( $_POST['range'] ) ? sanitize_key( wp_unslash( $_POST['range'] ) ) : ''; if ( ! in_array( $range, array( 'week', 'month', 'quarter' ), true ) ) { wp_die( esc_html__( 'Choose a valid report range.', 'acme-forms' ), '', array( 'response' => 400 ) ); }
Acme_Report_Service::refresh( $range ); $redirect = \ItouchCode\Forms\AdminNoticeStore::redirect_url( 'acme/reports', 'success', __( 'The report was refreshed.', 'acme-forms' ) ); if ( '' === $redirect ) { wp_die( esc_html__( 'The report redirect is unavailable.', 'acme-forms' ) ); } wp_safe_redirect( $redirect ); exit; }}
Acme_Reports_Action::hooks();Register callbacks from a companion plugin with WordPress add_filter() and
add_action(). Arrays described below are normalized data; return the same
shape and preserve unknown keys unless the hook says otherwise.
Form and submission hooks
Section titled “Form and submission hooks”| Hook | Kind | Arguments | Purpose |
|---|---|---|---|
itc_forms_field_type_registry |
filter | array $types |
Add a declarative server field type. Pair it with the JavaScript registry. |
itc_forms_condition_operator_registry |
filter | array $operators |
Add an authoritative operator descriptor. Pair it with JavaScript. |
itc_forms_default_definition |
filter | array $definition, string $context, string $apiVersion |
Adjust new-form/template defaults. |
itc_forms_product_feature_catalog |
filter | array $features, string $apiVersion |
Register stable Core, Pro, or add-on feature contracts. |
itc_forms_feature_available |
filter | bool $available, string $key, array $feature |
Override a validated feature entitlement. |
itc_forms_license_status |
filter | array $status, string $apiVersion |
Supply vendor-neutral license state and entitlement identifiers. |
itc_forms_update_metadata |
filter | ?array $metadata, array $license, string $apiVersion |
Supply HTTPS private-update metadata. |
itc_forms_default_email_feed |
filter | array $feed, string $purpose, string $apiVersion |
Adjust an administrator/submitter email default. |
itc_forms_form_definition_normalized |
filter | array $definition, array $existing |
Extend a normalized definition. |
itc_forms_validation_errors |
filter | array $errors, array $definition, array $values, array $required |
Add validation errors; do not remove core errors. |
itc_forms_validation_feedback |
filter | array $messages, array $errorKeys, array $definition |
Replace escaped copy for authoritative errors. |
itc_forms_submission_values_normalized |
filter | array $values, array $definition, string $formKey |
Normalize visible values before storage and feeds. |
itc_forms_entry_storage_enabled |
filter | bool $enabled, array $values, array $definition, string $formKey |
Make the final storage decision. |
itc_forms_confirmation_selection |
filter | string $message, array $values, array $definition, string $formKey |
Select confirmation copy. |
itc_forms_block_theme_tokens |
filter | array $tokens, array $attributes, string $mode |
Adjust sanitized semantic appearance tokens; receives no definition, submission, or secrets. |
itc_forms_enqueue_frontend_styles |
filter | bool $enqueue |
Return false during block registration to enable site-wide headless/no-default-styles mode. Semantic markup and behavior remain active. |
itc_forms_private_upload_directory |
filter | string $directory |
Change the absolute private-storage root. Use a non-public, persistent path writable by PHP; never derive it from submitted data. |
itc_forms_entry_created |
action | int $entryId, string $formKey |
React after persistence. Fetch private data only when necessary. |
itc_forms_form_saved |
action | int $formId, ?array $previous, ?array $current |
React after a form is created or its definition is saved. Definitions are normalized; current may be null only if the post could not be reloaded. |
itc_forms_form_lifecycle_changed |
action | int $formId, string $from, string $to, array $form |
React after publish, draft, archive, restore, trash, untrash, or delete. The delete transition uses to = deleted and supplies the pre-delete form. |
itc_forms_submission_completed |
action | int $entryId, string $formKey, bool $stored |
React after a valid submission has queued its selected automations. entryId can identify a transient payload; no submitted values are passed. |
itc_forms_submission_rejected |
action | string $formKey, string $status, list<string> $errorKeys |
Observe invalid or failed public submissions. Error keys are bounded and normalized; raw request data is never passed. |
itc_forms_entry_erased |
action | int $entryId, string $reason |
Remove extension-owned data after an entry is deleted. Reasons include manual, retention, transient_cleanup, and rollback. Make cleanup idempotent. |
Example: add a server error without weakening core validation.
add_filter( 'itc_forms_validation_errors', function ( array $errors, array $definition, array $values ): array { if ( isset( $values['company_code'] ) && ! preg_match( '/^[A-Z]{3}-[0-9]{4}$/', (string) $values['company_code'] ) ) { $errors[] = 'company_code'; } return $errors;}, 10, 3 );Example: disable storage for one form while leaving confirmation behavior unchanged.
add_filter( 'itc_forms_entry_storage_enabled', function ( bool $enabled, array $values, array $definition, string $formKey ): bool { return $formKey === 'transient-calculator' ? false : $enabled;}, 10, 4 );See Form design tokens for the stable token keys, accepted
values, settings.custom.itcForms mapping, and paired editor-preview hook.
Delivery hooks
Section titled “Delivery hooks”| Hook | Kind | Arguments |
|---|---|---|
itc_forms_email_recipient |
filter | string $recipient, string $formKey, string $feedKey |
itc_forms_email_reply_to |
filter | string $replyTo, string $formKey, string $feedKey |
itc_forms_email_subject |
filter | string $subject, string $formKey, string $feedKey |
itc_forms_email_message |
filter | string $message, string $formKey, string $feedKey |
itc_forms_submitter_confirmation_message |
filter | string $message, string $formKey, string $feedKey |
itc_forms_confirmation_redirect_url |
filter | string $url, string $formKey |
itc_forms_post_submit_redirect_url |
filter | string $url, int $entryId, string $formKey, array $values, array $definition |
itc_forms_public_trust_page_url |
filter | string $url, string $formKey |
itc_forms_translated_definition |
filter | array $displayDefinition, string $formKey |
itc_forms_webhook_url |
filter | string $url, string $formKey, string $feedKey |
itc_forms_webhook_secret |
filter | string $secret, string $formKey, string $feedKey |
Return destinations only from trusted configuration. Never derive a recipient,
URL, or secret directly from submitted values. itc_forms_feed_providers is
stable in extension API 1.0. New providers use its validated enqueue,
processor, and safe setting descriptors. itc_forms_managed_feed_execute
remains as a deprecated compatibility bridge.
Submitter-confirmation recipients are intentionally not filterable: the server derives them only from the configured email field after normalized submission validation. Subject and message filters may adjust trusted templates; the builder’s controlled merge-tag picker is the supported JavaScript surface.
Spam and network hooks
Section titled “Spam and network hooks”| Hook | Kind | Arguments |
|---|---|---|
itc_forms_turnstile_verification_payload |
filter | array $payload, string $formKey |
itc_forms_recaptcha_verification_payload |
filter | array $payload, string $formKey, array $definition |
itc_forms_hcaptcha_verification_payload |
filter | array $payload, string $formKey, array $definition |
itc_forms_hcaptcha_allowed_hostnames |
filter | string[] $hostnames |
itc_forms_recaptcha_score_threshold |
filter | float $threshold |
itc_forms_recaptcha_allowed_hostnames |
filter | string[] $hostnames |
itc_forms_recaptcha_verification_outcome |
filter | array $outcome, string $formKey, array $definition |
itc_forms_spam_challenge_providers |
filter | array $providers |
itc_forms_akismet_payload |
filter | array $payload, string $formKey, array $definition |
itc_forms_submission_is_spam |
filter | bool $spam, string $source, string $formKey |
itc_forms_spam_challenge_verification |
action | string $provider, string $formKey, bool $valid, string $reason |
itc_forms_spam_detected |
action | string $formKey, string $source |
itc_forms_trusted_client_ip |
filter | string $ip |
Only replace the client IP after verifying the immediate peer is a proxy you operate. Payload filters must not add secrets or unrelated personal data. reCAPTCHA restores its secret, visitor token, and trusted client address after the payload filter. Its outcome filter can make a valid core result stricter but cannot promote a failed result; no token, credential, hostname, score, raw response, or submitted value crosses the outcome filter/action boundary.
Challenge-provider descriptors contain key, label, available, render,
verify, and a plain-text privacy disclosure. available() returns a boolean;
render( string $formKey, array $definition ) prints the public control; and
verify( string $formKey, array $definition, array $post ) returns only
[ 'valid' => bool, 'reason' => 'bounded_identifier' ]. Core provider keys
cannot be replaced, and executable callbacks never enter the browser manifest.
Portability hooks
Section titled “Portability hooks”itc_forms_portable_export_metadata receives array $metadata, array $portableForm. Return JSON-compatible metadata under a vendor/name key; do
not include site IDs, personal data, destinations, or credentials.
itc_forms_portable_form_imported receives the validated metadata, new local
post ID, and source/local keys after a draft is created.
Retention
Section titled “Retention”itc_forms_retention_days is a legacy compatibility filter used by existing
sites. Prefer runtime constants or the per-form builder setting in new code;
its historical global and per-form calls have different context arguments and
are not a stable extension contract.
Additional extension hooks
Section titled “Additional extension hooks”Bulk entry actions (experimental in 0.9.0)
Section titled “Bulk entry actions (experimental in 0.9.0)”itc_forms_entry_bulk_action_registry( array $actions, string $apiVersion )
registers namespaced, capability-gated bulk mutations separately from ordinary
single-entry actions. Descriptors provide a plain-text label, callback, and a
maxBatch from 1 through 100. Core verifies the action nonce and every selected
entry ID/revision nonce, reloads each entry, and passes only its bounded status
summary. Each attempted callback has durable intent plus completion/failure
activity; partial failures do not erase successful records and are summarized
in a core-owned notice.
Readiness and development diagnostics (experimental in 0.9.0)
Section titled “Readiness and development diagnostics (experimental in 0.9.0)”itc_forms_readiness_check_registry( array $checks, string $apiVersion )
registers vendor/name checks with a plain-text label, evaluator, warning or
error severity ceiling, approved admin surface, and optional HTTPS
remediation URL. Evaluators receive only the form ID and an aggregate context
(stable key, revision, counts, field types, and provider keys). Definitions,
settings, credentials, destinations, requests, entries, and submitted values
are excluded. One exception: a check whose key is also an active
form-extension namespace receives a third argument, that namespace’s own
normalized data for the revision being evaluated (or null when the form
stores it at another schema version). It never receives another namespace’s
data. Declare the parameter with a default (mixed $data = null) and treat
func_num_args() < 3 as an older core that cannot supply it. Core checks are
immutable. Error results block publication, including re-saving an already
published form; saving a draft is never blocked. Warning ceilings cannot be
escalated into a publication block.
Mark remote checks with remote and a bounded cacheTtl. Normal rendering and
publication use cached state; only an explicitly authorized refresh runs the
remote evaluator. Invalid returns and exceptions become warnings and a
redacted diagnostic event.
When WP_DEBUG is enabled, itc_forms_extension_diagnostic( array $event )
observes bounded event metadata (type, component, key, and reason). It
never receives exception messages or extension values. Listener failures are
contained. This hook is for development observation, not authorization,
control flow, visitor output, or persistent logging of request data.
Semantic PHP UI slots (experimental in 0.9.0)
Section titled “Semantic PHP UI slots (experimental in 0.9.0)”Server-rendered screens expose additive actions through both the compatibility
dispatcher itc_forms_ui_slot( string $slot, array $context ) and the semantic
action itc_forms_ui_slot_{$slot}( array $context ). Register against the
semantic action when possible. Core catches callback failures so a companion
plugin cannot prevent the underlying screen from rendering.
The catalog covers form, entry, and delivery lists; entry details and activity;
settings sections; integration cards; tool sections; onboarding; workflow; and
account portal summaries and actions. ExtensionRegistry::UI_SLOTS is the
authoritative allowlist. Contexts contain only identifiers, bounded state,
counts, and evaluated capability booleans. They intentionally exclude form
definitions, submitted values, notes, delivery destinations and payloads,
credentials, raw requests/controllers, and import previews.
Slot output is additive. It must be escaped at output time and must not open or close markup owned by core. A slot does not grant a capability: extensions must still authorize and nonce-protect every mutation in their own controller.
itc_forms_field_settings: namespaced declarative field settings.itc_forms_field_renderer: trusted escaped control callback or core fallback.
See extension recipes for arguments and persistence rules.
Versioned feed providers
Section titled “Versioned feed providers”itc_forms_feed_providers now also receives the current provider API version.
Version-1 processor and enqueue descriptors remain compatible. A version-2
provider declares version: 2, an execute callback, and only its implemented
capabilities. Unsupported versions are rejected and capabilities whose callback
or payload is absent are removed. Core owns run claiming and finalization; the callback receives a
run-bound FeedProviderRuntime and returns a bounded succeeded, retry, or
failed result, so it cannot select another run. Its optional enqueue callback
receives only a FeedProviderEnqueueContext.
Registered secret keys use ProviderSecretStore; values are stored with
autoload disabled and only secretConfigured booleans enter browser manifests.
Diagnostics use allowlisted statuses, plain translated copy, and a structured
destination type/label summary. Provider tests return only the same redacted fields. Tests use
saved configuration, require form-edit authorization and a provider-bound
nonce, are rate limited, and never create a normal entry.
The following namespaced classes are stable public facades for provider API v2; their constructors are called by core and are not extension construction APIs:
ItouchCode\Forms\FeedProviderRuntime:run_id(): int,entry_id(): int,provider(): string,feed_key(): string,attempt(): int, andsecret(string $key): string.secret()resolves only a key declared by that provider and must be called only during execution; do not copy its result into diagnostics, notices, browser state, or exceptions.ItouchCode\Forms\FeedProviderEnqueueContext:provider(): string,entry_id(): int,form_key(): string, andfeed_key(): string. It contains no claim token, repository, submitted values, or credential.ItouchCode\Forms\ProviderSecretStore:configured(string $provider, string $key): bool,replace(string $provider, string $key, string $value): bool, andclear(string $provider, string $key): bool. The key must be declared by the normalized provider descriptor; values are limited to 4096 bytes and stored in a hashed, non-autoloaded option. Prefer the core provider admin controller. If a companion supplies its own settings controller, it must enforce an appropriate capability and provider-bound nonce before callingreplace()orclear().
ProviderSecretStore::get() and normalize_keys() support the core runtime and
are not application-level extension points. Provider code should obtain a
secret through FeedProviderRuntime::secret() so it stays bound to the claimed
provider run.