Skip to main content

GravityKit\GravityMigrate\Migration\FieldReport

The wizard's "Show what happens to each field" table, built in PHP.

Every surface that is not the wizard reads it from here: wp gk migrate to|from --dry-run prints the same table the Forms step draws, from the same analysis, so the two have to agree -- an operator who checks a migration on screen and then runs it from a script must not be told two different things about one field. The rules are src_component/fieldReport.js's, restated here rather than approximated, because an approximation would differ from the screen exactly where a migration is most surprising, and held to them by tests/data/field-report-cases.json, which both languages assert against.

A row is label, type (what the source called it), to (what the destination made it), happens (the verdict), required and skip -- the same six the component builds, so a change to what a row says is one change in two places rather than two designs.

Since: %ver%

Source: src/Migration/FieldReport.php:27

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Migration

Methods

MethodDescription
field_types()Every Gravity Forms field type this report names, with the name it is called by and the
content_outcomes()What a destination can carry a field's contents across AS, without making a field of it.
outcome_for_field()What happened to one field, said from both ends.
type_name()A friendly field-type name for the "In <destination>" column.
prepared_form()The prepared form an analysis describes.
rows()One row per source field: what it was, what it became, and what happened to it.

Method Reference

field_types()

public static function field_types(): array

Every Gravity Forms field type this report names, with the name it is called by and the

sentence describing what a source field turns into.

One table, not two: the middle column and the outcome beside it describe the same field, so split apart they drift into naming it two different ways on one row.

becomes is null where there is no conversion to describe -- a name is a name in both plugins -- and the verdict names the type instead. It is not a claim that a field of this type did not change: only \self::outcome_for_field(), holding both ends of the move, can say that.

Returns

  • array<string, — array{name:string, becomes:string|null}>

Since: %ver%

Source: src/Migration/FieldReport.php:45

content_outcomes()

public static function content_outcomes(): array

What a destination can carry a field's contents across AS, without making a field of it.

Three of the seven do this, and every one of them read "Not migrated" while the content sat on the destination form: Contact Form 7 splices a section break and an HTML block into the form template as markup with no tag around them, and WS Form turns a page break into the group its own pages are made of. Ninja Forms does the same job with a real html field, so it was already reported correctly -- which is what makes the other three a wording problem rather than a migration one.

name is what the "In <destination>" column says, and becomes the sentence beside it, the same pair \self::field_types() holds for a field: one table, so the two columns of one row cannot come to describe the thing differently.

The adapter names the key, \GravityKit\GravityMigrate\Exporters\Adapters\AbstractTargetAdapter::record_produced_content(), so the wording lives here with every other verdict rather than in seven adapters.

Returns

  • array<string, — array{name:string, becomes:string}>

Since: %ver%

Source: src/Migration/FieldReport.php:86

outcome_for_field()

public static function outcome_for_field( array $field, string $universal_from='', string $universal_to='' ): string

What happened to one field, said from both ends.

Both universal types are needed, not the destination type alone: read against a Gravity Forms map by itself, an imported Contact Form 7 text field that arrived as a Gravity Forms text field reads "Becomes a single line of text" -- a conversion, for a field that did not change -- and on an export the destination's slugs are not in that map at all, so every converted field would read "Added to the form".

"Added to the form" is true of exactly one thing: a field the destination invents that the source never had.

"Stays the same" is true of exactly one thing too, and it is the branch below: both ends read and agreeing. An end nobody could read is not evidence that nothing changed, and read as though it were, this said a Post Image exported as a file upload and a Time exported as a date had come across unchanged.

Parameters

NameTypeDefaultDescription
$fieldarrayThe destination field.
$universal_fromstring''The source field's universal type.
$universal_tostring''The destination field's universal type.

Returns

  • string

Since: %ver%

Source: src/Migration/FieldReport.php:133

type_name()

public static function type_name( array $field, string $universal='' ): string

A friendly field-type name for the "In <destination>" column.

Read by the key \self::type_key() resolves, which is the key the verdict beside it is read by: Ninja Forms' checkbox is a single box, and read through the Gravity Forms map it was called "Checkboxes".

Parameters

NameTypeDefaultDescription
$fieldarrayThe destination field.
$universalstring''Its universal type, where one was resolved.

Returns

  • string

Since: %ver%

Source: src/Migration/FieldReport.php:242

prepared_form()

public static function prepared_form( array $analysis )

The prepared form an analysis describes.

Preferred over reading the prepared form directly, because only four of the seven destinations put a plain list of labelled, typed fields there: WPForms keys them by id, Fluent Forms nests them under form_fields and names the type element, WS Form buries them in groups of sections. Read straight, those three yield nothing and every row falls through to "Combined with another field".

Parameters

NameTypeDefaultDescription
$analysisarrayThe analysis.

Returns

  • array | null

Since: %ver%

Source: src/Migration/FieldReport.php:276

rows()

public static function rows( array $analysis ): array

One row per source field: what it was, what it became, and what happened to it.

Parameters

NameTypeDefaultDescription
$analysisarrayThe analysis, as an adapter returned it (plus, on an export, the field-type context \GravityKit\GravityMigrate\Exporters\AnalysisContext attaches).

Returns

  • array<int, — array{label:string,type:string,to:string,happens:string,required:bool|null,skip:bool}>

Since: %ver%

Source: src/Migration/FieldReport.php:450