GravityKit\GravityMigrate\Platforms\WPForms\WPFormsDefinition
What GravityMigrate knows about WPForms.
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:19
Details
-
Kind:
class -
Namespace:
GravityKit\GravityMigrate\Platforms\WPForms -
Implements:
PlatformDefinition
Methods
| Method | Description |
|---|---|
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. |
is_hub() | Whether this is the platform every migration passes through. |
verified_against() | The plugin version the registry above was read from. |
live_merge_tags() | The smart tags WPForms says it has on this site. |
Method Reference
platform()
public static function platform(): string
The canonical platform id, matching FieldMapper's PLATFORM_* constants.
Returns
string
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:162
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/WPForms/WPFormsDefinition.php:169
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/WPForms/WPFormsDefinition.php:176
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/WPForms/WPFormsDefinition.php:183
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/WPForms/WPFormsDefinition.php:190
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/WPForms/WPFormsDefinition.php:197
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/WPForms/WPFormsDefinition.php:208
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/WPForms/WPFormsDefinition.php:216
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/WPForms/WPFormsDefinition.php:225
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.
WPForms hands both sides the same form handler.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$direction | string | Either import or export. |
Returns
string[]— Class, interface or function names, all of which must be present.
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:236
is_hub()
public static function is_hub(): bool
Whether this is the platform every migration passes through.
Being the hub is a role a platform fills, and this is the only place it is recorded: nothing else branches on the hub's name.
Returns
bool
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:243
verified_against()
public static function verified_against(): string
The plugin version the registry above was read from.
Returns
string
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:250
live_merge_tags()
public static function live_merge_tags(): array
The smart tags WPForms says it has on this site.
SmartTags::get_smart_tags() runs the wpforms_smart_tags filter over its own list
(src/SmartTags/SmartTags.php:81), so add-on tags are included. The list is keyed by the tag
name without its braces, which is how WPForms stores them and not how they appear in text.
Returns
string[]
Since: %ver%
Source: src/Platforms/WPForms/WPFormsDefinition.php:331