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
| Method | Description |
|---|---|
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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form | array | Gravity Forms form array. | |
$form | UniversalForm | UniversalForm 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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form_id | int | Gravity Forms form ID. | |
$form | UniversalForm | UniversalForm to store. | |
$source_snapshot | array | [] | 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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form_id | int | Gravity 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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form_id | int | Gravity Forms form ID. | |
$platform | string | Platform 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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form_id | int | Gravity 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
| Name | Type | Default | Description |
|---|---|---|---|
$gf_form_id | int | Gravity Forms form ID. |
Returns
bool
Since: %ver%
Source: src/Schema/UniversalSidecar.php:188