Skip to main content

GravityKit\GravityMigrate\Schema\UniversalSidecar

Stores and reloads the canonical UniversalForm for a migrated Gravity Forms

form.

A lossless round trip depends on the original cross-platform model surviving from the import leg to a later export leg. The sidecar keeps it -- fields, ExtensionData and TransformationLog -- under a namespaced key on the Gravity Forms form itself, so it travels with the form.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:25

Details

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

Methods

MethodDescription
attach()Attaches the serialized UniversalForm to a Gravity Forms form array.
store()Persists the UniversalForm sidecar onto an existing Gravity Forms form.
load_source_snapshot()Returns the untouched source-platform form recorded at import, if any.
source_form_for_platform()Returns the recorded source form when it came from the given platform.
load()Reloads the UniversalForm sidecar for a Gravity Forms form.
has()Checks whether a Gravity Forms form carries a UniversalForm sidecar.

Method Reference

attach()

public static function attach( array $gf_form, UniversalForm $form ): array

Attaches the serialized UniversalForm to a Gravity Forms form array.

For a form that does not exist yet, so the sidecar is written by the same call that creates it. Use store() for a form that is already saved.

Parameters

NameTypeDefaultDescription
$gf_formarrayGravity Forms form array.
$formUniversalFormUniversalForm to attach.

Returns

  • array — The form array with the sidecar attached.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:62

store()

public static function store( int $gf_form_id, UniversalForm $form, array $source_snapshot=[] ): bool

Persists the UniversalForm sidecar onto an existing Gravity Forms form.

Parameters

NameTypeDefaultDescription
$gf_form_idintGravity Forms form ID.
$formUniversalFormUniversalForm to store.
$source_snapshotarray[]The untouched source-platform form. Left as it is when empty, so a later store cannot erase one already there.

Returns

  • bool — True on success.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:80

load_source_snapshot()

public static function load_source_snapshot( int $gf_form_id ): ?array

Returns the untouched source-platform form recorded at import, if any.

Sending this back to the platform it came from is the only way a field Gravity Forms cannot represent survives the round trip.

Parameters

NameTypeDefaultDescription
$gf_form_idintGravity Forms form ID.

Returns

  • array | null — The snapshot, carrying 'platform', 'source_id' and 'form'. Null when none was recorded or the recorded one is missing its platform or its form.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:111

source_form_for_platform()

public static function source_form_for_platform( int $gf_form_id, string $platform ): ?array

Returns the recorded source form when it came from the given platform.

Parameters

NameTypeDefaultDescription
$gf_form_idintGravity Forms form ID.
$platformstringPlatform the caller is exporting to.

Returns

  • array | null — The original form array, or null when it came from somewhere else.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:137

load()

public static function load( int $gf_form_id ): ?UniversalForm

Reloads the UniversalForm sidecar for a Gravity Forms form.

Parameters

NameTypeDefaultDescription
$gf_form_idintGravity Forms form ID.

Returns

  • UniversalForm | null — The stored UniversalForm, or null when absent or unreadable. A sidecar damaged outside this plugin counts as absent however it fails, so an export that only wanted the origin form still runs.

Since: %ver%

Source: src/Schema/UniversalSidecar.php:165

has()

public static function has( int $gf_form_id ): bool

Checks whether a Gravity Forms form carries a UniversalForm sidecar.

Parameters

NameTypeDefaultDescription
$gf_form_idintGravity Forms form ID.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalSidecar.php:188