Docs

API referenceChangelogStatus
Documentation menu
Developers › Adapter contract

Adapter contract

Each form plugin is supported by an adapter: a PHP class extending FormVigilant_Adapter in its own folder with no imports from other adapters, so it can ship separately later. Adapters are registered with the formvigilant_adapters filter.

Methods

abstract class FormVigilant_Adapter {
    abstract public static function slug(): string;
    abstract public static function is_active(): bool;
    abstract public function discover(): array;
    abstract public function submit( int $form_id, string $marker, array $overrides = array() ): array;
    abstract public function find_entry( int $form_id, string $marker ): ?int;
    abstract public function delete_entry( int $entry_id ): bool;
    abstract public function suppress_side_effects(): void;
    abstract public function capabilities( int $form_id ): array;
}
MethodMust
slug()Return a stable identifier such as wpforms or gravityforms
is_active()Return true only when the form plugin is loaded
discover()List forms with form_id, title, pages, fields (id, type, label, required), recipients and capabilities
submit()Submit fixed test values containing the marker through the plugin's own processing. Return ok, errors and entry_id when known
find_entry()Find the entry that contains the marker, or null
delete_entry()Delete only an entry that contains a marker
suppress_side_effects()Before submit, switch off CRM feeds, integrations, autoresponders and redirects for this request only
capabilities()Return levels, side_effects (suppressed or unknown), testable and unsupported field types

Rules

  1. Never touch real submissions. Read, return or delete only entries that contain a FormVigilant marker.
  2. Fixed public values. Name "FormVigilant Test", email test+<marker>@formvigilant.com, phone +1 555 0100, message "[FormVigilant test] Automated delivery check" with the marker. First option for choice fields; consent ticked.
  3. Keep the notification. The admin notification is what is under test. Prefix its subject with [FormVigilant test] where the plugin allows.
  4. Report what you cannot suppress. If a callback on the plugin's after-submit hooks belongs to code the adapter does not recognise, report side_effects: "unknown". FormVigilant then asks the agency to confirm before testing.
  5. Restore state. Remove every filter added for the test after the request, so nothing leaks into the next real submission in the same process.
  6. Not testable is not failing. Forms that require payment, file or signature fields return testable: false with the field types in unsupported.

Filters for site developers

FilterUse
formvigilant_adaptersRegister or remove adapters
formvigilant_side_effectsMark a form's side effects as suppressed once you have handled them in your own code
formvigilant_api_urlPoint a staging site at a staging API
formvigilant_daily_capLower the per-form daily test cap