Skip to content

ITC Forms 0.15.6Changelog

Extension recipes

These additive APIs are available since ITC Forms 0.9.0. API manifest version remains 1.0.0; fieldSettings is an optional addition so earlier manifests remain readable.

The following table describes reference implementations; these three examples are not included in the downloadable ITC Forms plugin ZIP. They illustrate separate plugins with their own bootstrap and includes/ class, not features that are automatically enabled.

Example Try it Demonstrates
itc-forms-example-company-code Add Company code; submit AB123456, then an invalid code Paired field registration, React and PHP renderers, authoritative validation
itc-forms-example-uppercase Select a Text or Textarea field and enable Require uppercase letters A field-level setting with automatic editor UI, defaults, persistence and server validation; no JavaScript required
itc-forms-example-entry-note Add Set entry note under Automations, publish and submit Declarative text/checkbox settings and a queued handler using the shared lifecycle

The note example sets the entry’s internal note to the configured text. It skips an existing note unless the manager selects Replace an existing note. It never sends data to an external service. Background delivery depends on the normal WordPress cron runner. Example labels use ITC Forms’ English/nl_BE catalog.

Register itc_forms_field_settings with a vendor/feature namespace:

add_filter( 'itc_forms_field_settings', static function ( array $groups ): array {
$groups['acme/rules'] = array(
'label' => 'Text rules',
'types' => array( 'text', 'textarea' ),
'settings' => array(
array( 'key' => 'uppercase_only', 'label' => 'Require uppercase',
'control' => 'checkbox', 'default' => false ),
),
);
return $groups;
} );

An empty types list applies to all types. The builder creates accessible controls automatically. Controls are text, textarea, email, url, number, checkbox and select; select options are {value, label} records. help, required and default work like automation settings. Checkbox values are booleans; other values are strings. Use add-on-specific setting keys rather than repurposing typed built-in properties such as recipient, url or useAdminEmail with a different control type. Server normalization applies defaults, strips undeclared keys in registered groups, validates email/URL/number/select values, and enforces required settings. This uses the same schema as automations.

Values persist at:

field.extensions['acme/rules'] = {
version: '1.0',
data: { uppercase_only: true },
};

Unknown namespaces and newer envelope versions are bounded and preserved, not interpreted. Settings for nonmatching field types also remain inert and preserved. Consumers must check their supported version and field type before applying behavior. An older client omitting the field’s extensions retains stored envelopes by field UID. Explicitly empty extensions remove stored data; active declarations then apply defaults. Configuration is not secret storage. Do not put credentials or per-submission values in definitions or descriptors.

Persistence does not implement behavior: use itc_forms_validation_errors, a renderer or another appropriate runtime hook to consume the setting. The uppercase example validates only visible values and retains core errors.

Keep paired PHP itc_forms_field_type_registry and JavaScript itcForms.builder.fieldTypes registrations. Core still controls storage shape, sanitization, conditional visibility and authoritative submission validation.

itc_forms_field_renderer filters a callable (default null) using the field and render context. Return your callback only for your type. The callback receives (field, context) and echoes escaped markup. It must preserve:

  • context.id, name and label for a labeled, submitted control;
  • value, required, invalid and describedBy for state and feedback;
  • native input/change semantics if using the core frontend conditional engine.

Core retains the surrounding field wrapper and help/error elements. This is a trusted PHP callback, not user-authored HTML. A missing/non-callable renderer falls back to the core control. Renderers must escape dynamic attributes/text and are responsible for accessible custom interaction. Use a field’s validation message setting for format-specific feedback.

itcForms.builder.fieldRenderers filters a map of type keys to React function components. Props are { field, id, value, required, disabled, onChange }. Both the standalone builder and Gutenberg preview use it. Register before the ITC Forms editor bundle initializes. Use onChange in rule-testing mode and honor disabled in static previews. The example’s plain JS asset needs no build step. Arbitrary composite data shapes still need a supported core sanitizer; rendering a new widget alone does not create a new storage format.

Return ManagedAutomation::descriptor($slug, $label, $settings, $handler) from itc_forms_feed_providers. It supplies the existing enqueue and processor callbacks, so custom add-ons do not need queue SQL or claim-token handling. Legacy provider descriptors continue to work unchanged.

The handler receives:

Key Meaning
runId, entryId, formKey, feedKey Stable stored identities
settings Current enabled feed’s normalized configuration
values Stored entry values; handle as personal data
entry Bounded canonical email, name, and server-recorded consentAt; personal data
form Bounded display-only title plus field key/label pairs
attempt One-based attempt number
idempotencyKey Stable key for the same run on this site across retries

Return succeeded, failed, or retry. The site-wide retry limit defaults to two retries after the first attempt. The first retry can run after 60 seconds and later retries after 300 seconds; the normal five-minute poller and site cron traffic determine actual timing. Exceptions and unknown results fail permanently using a generic error code, without storing exception text. Missing entries/forms, unpublished forms, removed feeds and disabled feeds prevent the handler from running. Completed or actively claimed runs cannot be processed again by another normal worker.

The context is read-only and contains no repository object, claim token, credential, raw request, or provider response. Treat values and entry as personal data and never include the context in diagnostics. Core exposes at most 200 normalized field key/label pairs; add-ons must still validate values for their destination.

This is not an exactly-once guarantee for external side effects. A process can stop after an external request succeeds but before local completion is recorded, or outlive its queue lease. Supply idempotencyKey to a destination that honors it, or make the operation idempotent (as the note example does). A newly enqueued run has a new key; deduplication across separate submissions or newly created runs is the add-on’s responsibility. Resolve secrets from server configuration, enforce destination-specific permissions, and explicitly choose whether a known failure is safe to retry.

The installable itc-forms-companion-scaffold is the executable baseline. Build cohesive features from these contracts; do not turn each row into an otherwise empty plugin.

Feature Public contract Threat model and required assertions
Field and condition operator itc_forms_field_type_registry, itc_forms_condition_operator_registry, paired itcForms.builder.fieldTypes Client descriptors are untrusted. Test namespace reservation, scalar normalization, invalid operators, PHP/JS pairing, and authoritative evaluation.
Field settings and renderer itc_forms_field_settings, itc_forms_field_renderer Definitions may contain forged keys and render context may contain hostile text. Test schema stripping, defaults, escaped attributes/text, labels, errors, and core fallback.
Form extension section itc_forms_form_extension_registry and its registered namespace setter Browser code may mutate only declared browser-writable keys. Test create/save/import/duplicate migration, server-only rejection, and unknown-newer envelope preservation.
Feed provider itc_forms_feed_providers, ProviderSecretStore, FeedProviderRuntime Never expose credentials, claim tokens, raw responses, or repositories. Test autoload-disabled isolation, configured booleans, run binding, malformed outcomes, bounded retries, idempotency, and redacted diagnostics/tests.
Spam provider itc_forms_spam_provider_registry Tokens and consent are attacker-controlled. Test availability exceptions, token-field isolation, strict-true verification, bounded reasons, consent-gated loading, teardown, action/hostname/score validation, and no raw-token diagnostics.
Builder panel and slot fill itcForms.builder.panels, itcForms.builder.slotFills Slots are display-only unless given a registered setter. Test duplicate keys, least-power context, callback containment, escaping, and legacy slot compatibility.
Admin page itc_forms_admin_page_registry and semantic UI slots A menu registration grants no mutation authority. Test fixed baseline plus descriptor capability, screen scoping, nonce-protected writes, escaped output, and callback failure containment.
Readiness check itc_forms_readiness_check_registry Checks observe redacted summaries and cannot weaken core failures. Test cache/refresh behavior, status ceilings, exception redaction, and absence of definitions or credentials.
Form and entry action itc_forms_form_action_registry, itc_forms_entry_action_registry IDs, revisions, and POST payloads are untrusted. Test baseline and descriptor capabilities, tuple-bound nonce, reload-before-mutate, strict result schema, audit intent/completion, and fixed redirects.
Workflow state and transition itc_forms_entry_workflow_state_registry, itc_forms_entry_workflow_transition_registry, itc_forms_entry_event_type_registry Core states/events are immutable. Test namespace rules, source/target validation, availability failure, revision conflict, atomic state/event update, and PII-free summaries.
Portable metadata registered form-extension envelopes and portability filters Imports are hostile and future add-ons may be absent. Test namespaced schema normalization, migrations, secret stripping, unknown envelope preservation, and failed-import rollback without success events.
Privacy export/erasure WordPress exporter/eraser APIs plus provider privacy descriptors Email addresses identify people and callbacks must not broaden access. Test ownership, pagination, erasure retention messages, no secrets, and uninstall scope.
Headless styling semantic classes and CSS custom properties in design-tokens.md DOM structure is not an API. Test documented tokens and semantic hooks at mobile/desktop widths without selectors tied to incidental nesting.

Every recipe also needs a negative test for malformed descriptors and callback exceptions. Lifecycle actions are observational; policy filters must be made stricter or ignored when invalid; no example may require an internal repository, controller, database table, compiled bundle module, or DOM implementation detail.

Executable server recipes are packaged in recipes/contracts.php, with the paired builder fill in recipes/builder.js and semantic headless tokens in recipes/headless.css. Copy only the cohesive recipes an extension owns; the files are intentionally not loaded by the scaffold bootstrap automatically.