Skip to main content

GravityKit\GravityMigrate\Importers\Adapters\AbstractSourceAdapter

Provides shared adapter helpers and importer access.

Since: %ver%

Source: src/Importers/Adapters/AbstractSourceAdapter.php:39

Details​

  • Kind: class

  • Namespace: GravityKit\GravityMigrate\Importers\Adapters

  • Implements: SourceAdapterInterface

Properties​

PropertyTypeDescription
$importerPipelineContextImporter context.
$layout_group_indexintHow many layout groups this adapter has minted.
$merge_tag_messagesstring[]What this import took out of somebody's wording, in the words the operator reads.

Methods​

MethodDescription
take_untranslatable_tag_warnings()The losses nobody has reported yet, handed over and forgotten.
__construct()Constructor.
build_prepared_payload()Builds a prepared payload for a Gravity Forms import.
to_universal_form()Reads one source form as a UniversalForm, through the same sequence as the payload.

Method Reference​

take_untranslatable_tag_warnings()​

public function take_untranslatable_tag_warnings(): array

The losses nobody has reported yet, handed over and forgotten.

Read by the importer as it finishes a payload, so a loss an adapter recorded and never mentioned still reaches the migration report. Clearing on the way out is what stops the same sentence being said twice when the payload is finished more than once.

Returns​

  • string[]

Since: %ver%

Source: src/Importers/Adapters/AbstractSourceAdapter.php:299

__construct()​

public function __construct( PipelineContext $importer )

Constructor.

Takes the migration's context rather than an importer specifically, because the Gravity Forms source adapter runs on the export side, where there is no importer to hand it.

Parameters​

NameTypeDefaultDescription
$importerPipelineContextThe migration this conversion is part of.

Since: %ver%

Source: src/Importers/Adapters/AbstractSourceAdapter.php:1051

build_prepared_payload()​

final public function build_prepared_payload( array $source_form )

Builds a prepared payload for a Gravity Forms import.

The sequence every import runs, owned here so that an adapter fills in its steps rather than restating the order. A step added here runs for every adapter, including one that has never heard of it.

The order: forget the previous form, convert this one (\self::convert()), hold every field to the decisions Gravity Forms will otherwise make for it (\self::warn_about_unstated_decisions()), say so if this form has been here before, fill the form out to the shape Gravity Forms expects, and assemble the payload every surface reads. A refusal from the conversion is handed back untouched, so an adapter's own error code and sentence reach the operator as written.

Parameters​

NameTypeDefaultDescription
$source_formarrayThe form as the source platform's reader handed it over.

Returns​

  • array | \WP_Error

Since: %ver%

Source: src/Importers/Adapters/AbstractSourceAdapter.php:1075

to_universal_form()​

final public function to_universal_form( array $source_form )

Reads one source form as a UniversalForm, through the same sequence as the payload.

The universal form is what a migration carries between two platforms when the hub is not the destination: a source adapter's output, projected once, is what any target adapter's \GravityKit\GravityMigrate\Exporters\Adapters\AbstractTargetAdapter::build_from_universal() consumes. Nothing in this path touches GFAPI. The projection is the hub's own reader, so a form crossing this way is exactly the form the hub would have stored, leftovers parked in its extensions; EveryTypeCrossesTheCarrierTest holds every readable type of every platform to that.

What the conversion had to say travels on the form itself, so a report can be drawn from it without the array envelope.

Parameters​

NameTypeDefaultDescription
$source_formarrayThe form as the source platform's reader handed it over.

Returns​

  • UniversalForm | \WP_Error

Since: %ver%

Source: src/Importers/Adapters/AbstractSourceAdapter.php:1134