Skip to main content

GravityKit\GravityMigrate\Platforms\GravityForms\GravityFormsDefinition

What GravityMigrate knows about Gravity Forms.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:22

Details​

  • Kind: class

  • Namespace: GravityKit\GravityMigrate\Platforms\GravityForms

  • Implements: PlatformDefinition

Properties​

PropertyTypeDescription
$simulate_gravityviewbool | nullOverrides the GravityView detection in conditional_merge_tags(); tests only.

Methods​

MethodDescription
platform()The canonical platform id, matching FieldMapper's PLATFORM_* constants.
aliases()The slugs the importer and exporter registries use for this platform.
to_universal()This platform's field types, mapped to universal types.
from_universal()Universal types, mapped to this platform's field types.
registered_types()Every field type this platform registers, read from the plugin itself.
intentional_asymmetry()Platform types whose two directions differ on purpose, keyed by the type read.
submit_types()The subset of this platform's chrome that IS the form's submit button.
chrome_types()Types the platform registers that hold no submitted data.
dropped_types()Types this platform reads but cannot turn into a Gravity Forms field, with the reason.
required_for()What has to be installed for this platform to be read from or written to.
import_decisions()Field properties whose ABSENCE is a decision, by field type.
is_hub()Whether this is the platform every migration passes through.
edit_url()Where a person edits one of this platform's forms.
verified_against()The plugin version the registry above was read from.
live_merge_tags()The merge tags Gravity Forms says it has on this site.
conditional_merge_tags()Spellings that exist only when another plugin supplies them.
resolved_merge_tag_values()The values written out as themselves, because Gravity Forms has no tag for them.

Method Reference​

platform()​

public static function platform(): string

The canonical platform id, matching FieldMapper's PLATFORM_* constants.

Returns​

  • string

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:543

aliases()​

public static function aliases(): array

The slugs the importer and exporter registries use for this platform.

The registries use hyphenated slugs ('ninja-forms') while the schema uses underscored ids ('ninja_forms'), and several platforms answer to more than one spelling.

Returns​

  • string[]

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:550

to_universal()​

public static function to_universal(): array

This platform's field types, mapped to universal types.

Returns​

  • array<string, — string>

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:557

from_universal()​

public static function from_universal(): array

Universal types, mapped to this platform's field types.

Every value has to be a type the platform registers, because a platform renders nothing for a type it does not know and says nothing about it either.

Returns​

  • array<string, — string>

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:564

registered_types()​

public static function registered_types(): array

Every field type this platform registers, read from the plugin itself.

This is the list a written type is checked against. It is a pinned snapshot: the plugin is the authority, and this is what we last read from it.

Returns​

  • string[]

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:571

intentional_asymmetry()​

public static function intentional_asymmetry(): array

Platform types whose two directions differ on purpose, keyed by the type read.

A definition's two maps are meant to be inverses. Where they are not it is nearly always a bug -- one direction fixed and not the other -- but occasionally the type a platform hands us is not the type that behaves when we hand it back. Declaring those with the reason is what stops the disagreement being discovered later in somebody's migrated form.

Returns​

  • array<string, — string> Platform type => why the two directions differ.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:578

submit_types()​

public static function submit_types(): array

The subset of this platform's chrome that IS the form's submit button.

Source adapters carry the button's text into the migrated form's own submit-button setting, so the field table must report it as the button rather than as "combined with another field", which is true of two name inputs becoming one Name field and false of a button.

Empty where the platform keeps its button on the form rather than in the field list, which is a real answer rather than a gap: WPForms reads settings.submit_text and Forminator submitData, so neither has a field to report.

Returns​

  • string[]

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:589

chrome_types()​

public static function chrome_types(): array

Types the platform registers that hold no submitted data.

A submit button, a section's add and delete icons, a preview panel showing what has been typed so far: real registered types that a real exported form contains, with nothing in them to carry. Declaring them separates a deliberate drop from a forgotten one, which are indistinguishable from the outside and have very different consequences.

Returns​

  • string[]

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:596

dropped_types()​

public static function dropped_types(): array

Types this platform reads but cannot turn into a Gravity Forms field, with the reason.

A type can be mapped correctly here and the adapter still produce nothing for it. Left undeclared, the definition claims a conversion that does not happen: a Ninja repeater says it becomes a Gravity Forms repeater while the import drops it, taking every child with it.

A drop declared here has to also be reported at migration time. Silent is the failure mode; a person who is told a field could not come across can go and rebuild it.

Returns​

  • array<string, — string> Platform type => why nothing can be produced for it.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:606

required_for()​

public static function required_for( string $direction ): array

What has to be installed for this platform to be read from or written to.

Gravity Forms is the hub, reached through its API either way.

Parameters​

NameTypeDefaultDescription
$directionstringEither import or export.

Returns​

  • string[] — Class, interface or function names, all of which must be present.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:617

import_decisions()​

public static function import_decisions(): array

Field properties whose ABSENCE is a decision, by field type.

A field written without one of these is not a field with a default; it is a field on which a decision was made by nobody. What then happens is decided by whichever layer fills the blank. Three of these the normalizer fills with one fixed value whatever the source form had (src/Schema/field-defaults.php): dateType becomes datepicker, timeFormat becomes 12, numberFormat becomes decimal_dot. Two it leaves blank for Gravity Forms to read as its own default: an empty dateFormat is mm/dd/yyyy (class-gf-field-date.php:104) -- silent for 03/04/2026 and a refusal for 25/12/2026 -- and an empty phoneFormat names no format at all, so no mask is drawn and any text is accepted (class-gf-field-phone.php:925-929, :303-306).

Gravity Forms' own migrators leave these blank, so a form that looks migrated then reads dates in the wrong order. Every source adapter has to state each of them on every field of the type, from what the source form said, and \GravityKit\GravityMigrate\Importers\Adapters\AbstractSourceAdapter::build_prepared_payload() holds all of them to it before the normalizer runs, so an adapter cannot decide by forgetting.

addressType is deliberately absent. An address with no type is not an international one: Gravity Forms reads an empty type through the site's own gform_default_address_type filter (class-gf-field-address.php:560), so leaving it blank defers to a decision the site has already made. Stating one where the source named none would take it away.

Returns​

  • array<string, — array<string, array{what: string, otherwise: string}>> Gravity Forms field type => property => what the property decides, and what the migrated field gets when nobody decided it.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:652

is_hub()​

public static function is_hub(): bool

Whether this is the platform every migration passes through.

Every migration passes through Gravity Forms.

Returns​

  • bool

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:690

edit_url()​

public static function edit_url( $form_id ): string

Where a person edits one of this platform's forms.

Every surface that creates a form hands back a link to it, and each platform keeps its editor at its own address. Stated here rather than in each exporter, so the surfaces that link to the hub's forms read the same fact the same way.

Parameters​

NameTypeDefaultDescription
$form_idint | stringThe form's id on this platform, or a client-side placeholder.

Returns​

  • string

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:701

verified_against()​

public static function verified_against(): string

The plugin version the registry above was read from.

Returns​

  • string

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:708

live_merge_tags()​

public static function live_merge_tags(): array

The merge tags Gravity Forms says it has on this site.

GFCommon::get_merge_tags() returns the picker's own grouped list, which runs gform_custom_merge_tags (common.php:1031), so add-on tags that advertise themselves are included. The field groups come back empty here because no fields are passed: this asks what the platform offers, and field references are a separate kind that follows the field.

This is what Gravity Forms advertises, which is not the same as what works. A tag can resolve without ever appearing in the picker, because gform_replace_merge_tags is a text-processing filter and there is no way to ask a listener which tags it handles. GravityView registers {site_url} exactly that way (GravityKit\GravityView\Renderer\MergeTags::replace_site_url, hooked to gform_replace_merge_tags), so the picker never mentions it and it works anyway. There is no complete enumeration of Gravity Forms merge tags to be had; the ones this plugin knows about but the picker omits are added below rather than left invisible.

Returns​

  • string[]

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:733

conditional_merge_tags()​

public static function conditional_merge_tags(): array

Spellings that exist only when another plugin supplies them.

Gravity Forms itself replaces {admin_url} and {logout_url} (GFCommon::replace_variables(), common.php:1502, :1509) and has no case for {site_url}; GravityView registers that one on gform_replace_merge_tags (src/Renderer/MergeTags.php:665). So {site_url} works only where GravityView is loaded, and declaring it in MERGE_TAGS would mail the literal characters to the reader on every other site. Absent here, the value falls through to resolved_merge_tag_values() and the address itself is written.

Read at migration time, the one moment this plugin gets to choose: a site that later drops GravityView loses the tag with the rest of GravityView; one that never had it gets text that depends on nothing.

Returns​

  • array<string, — string>

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:799

resolved_merge_tag_values()​

public static function resolved_merge_tag_values(): array

The values written out as themselves, because Gravity Forms has no tag for them.

Gravity Forms core replaces no site-name tag. Every other platform names the site, so a migrated notification that says "Sent from the site" has a value with nowhere to go, and both of the usual endings spoil the email -- passing the tag through sends the reader {site_name}, removing it sends "Sent from ."

The site's name does not change between the migration and the email, so writing it settles the sentence. Nothing is lost either: the origin form is recorded whole in the sidecar and a notification's wording is not in AbstractExporter::EDITED_IN_GRAVITY_FORMS, so an export back to the origin restores that platform's own tag rather than this value.

Returns​

  • array<string, — string>

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsDefinition.php:832