GravityKit\GravityMigrate\Platforms\PlatformDefinition
What GravityMigrate knows about one form plugin, stated once.
Both directions read their facts from here, so the importer and the exporter cannot disagree about somebody else's data format -- the failure that silently emails nobody, or round-trips a setting key the other plugin has never had.
What belongs here is declarative: the field type vocabulary, the keys a platform stores things under, its condition operators, its date formats. The conversion itself does not. Forminator's post data field becomes several Gravity Forms fields; WPForms' date-time becomes a date or a time depending on its own format setting; Contact Form 7's output is text markup rather than an array. The adapters keep doing that work.
Since: %ver%
Source: src/Platforms/PlatformDefinition.php:25
Details
- Kind:
interface - Namespace:
GravityKit\GravityMigrate\Platforms
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. |
chrome_types() | Types the platform registers that hold no submitted data. |
submit_types() | The subset of this platform's chrome that IS the form's submit button. |
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 merge tags this platform's plugin says it has, right now, 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/PlatformDefinition.php:34
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/PlatformDefinition.php:46
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/PlatformDefinition.php:55
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/PlatformDefinition.php:67
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/PlatformDefinition.php:79
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/PlatformDefinition.php:93
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/PlatformDefinition.php:107
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/PlatformDefinition.php:124
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/PlatformDefinition.php:140
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.
The two lists are not always the same: exporting to Fluent Forms writes meta a reader never touches, and importing from Forminator reads through an API the exporter has no use for.
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/PlatformDefinition.php:154
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/PlatformDefinition.php:166
verified_against()
public static function verified_against(): string
The plugin version the registry above was read from.
Returns
string
Since: %ver%
Source: src/Platforms/PlatformDefinition.php:175
live_merge_tags()
public static function live_merge_tags(): array
The merge tags this platform's plugin says it has, right now, on this site.
Read from the plugin rather than listed in code: the built-in tags are only part of the
list, because every platform here lets add-ons register more (Gravity Forms through
gform_custom_merge_tags), so a hard-coded list goes stale the moment one is installed.
This answers what a tag is, not what it means. A tag that appears here with no entry in
MERGE_TAGS is one this plugin can recognise but not translate, and reporting that is what
stops a customer receiving an email with {other:user_ip} written in it.
Returns an empty array when the plugin is not active, which is not the same as the plugin having no tags; callers migrating to or from a platform have it active by definition.
Returns
string[]— Tag literals, exactly as the plugin spells them.
Since: %ver%
Source: src/Platforms/PlatformDefinition.php:195