Skip to main content

GravityKit\GravityMigrate\Platforms\GravityForms\GravityFormsSourceAdapter

Turns a Gravity Forms form into a UniversalForm.

Being the hub is a role rather than a reason to be shaped differently, so this is an adapter like the others and reads its platform the way the WPForms adapter reads WPForms.

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:29

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Platforms\GravityForms
  • Extends: AbstractSourceAdapter

Methods

MethodDescription
notification_to_universal()Reads a Gravity Forms notification as a universal one.
confirmation_to_universal()Reads a Gravity Forms confirmation as a universal one.
conditional_logic_to_universal()Reads Gravity Forms conditional logic as universal logic.
to_universal()Produces a UniversalForm from a Gravity Forms form array.
field_to_universal()Produces a UniversalField from a Gravity Forms field array.
build_prepared_payload()Builds a prepared payload for a Gravity Forms import.

Method Reference

notification_to_universal()

public static function notification_to_universal( array $gf_notification ): UniversalNotification

Reads a Gravity Forms notification as a universal one.

The simple slots come from the definition's map rather than from keys spelled here, so the only place a Gravity Forms key appears is next to the slot it fills, where a gate can check it against the vendor's source and against the object.

Parameters

NameTypeDefaultDescription
$gf_notificationarrayA single entry of a form's notifications.

Returns

  • UniversalNotification

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:55

confirmation_to_universal()

public static function confirmation_to_universal( array $gf_confirmation ): UniversalConfirmation

Reads a Gravity Forms confirmation as a universal one.

Which named constructor runs is decided by the stored type, and each carries the value that type needs, so a redirect with no url or a page confirmation with no page cannot be built. An unrecognised type is read as a message, which is the one of the three that needs nothing beyond text and so cannot produce a confirmation pointing nowhere.

Parameters

NameTypeDefaultDescription
$gf_confirmationarrayA single entry of a form's confirmations.

Returns

  • UniversalConfirmation

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:105

conditional_logic_to_universal()

public static function conditional_logic_to_universal( $logic ): ?UniversalConditionalLogic

Reads Gravity Forms conditional logic as universal logic.

Returns null both when there is no logic and when a rule could not be translated, which are different facts with the same safe handling: a rule set that lost a rule decides differently from the one somebody built, so UniversalConditionalLogic refuses the whole set rather than running a trimmed one.

Parameters

NameTypeDefaultDescription
$logicmixedThe conditionalLogic value, which Gravity Forms leaves as an empty string on forms that have never used it.

Returns

  • UniversalConditionalLogic | null

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:227

to_universal()

public static function to_universal( array $gf_form ): UniversalForm

Produces a UniversalForm from a Gravity Forms form array.

Parameters

NameTypeDefaultDescription
$gf_formarrayGravity Forms form array.

Returns

  • UniversalForm

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:278

field_to_universal()

public static function field_to_universal( array $gf_field ): UniversalField

Produces a UniversalField from a Gravity Forms field array.

Parameters

NameTypeDefaultDescription
$gf_fieldarrayGravity Forms field array.

Returns

  • UniversalField

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:320

build_prepared_payload()

public function build_prepared_payload( array $source_form )

Builds a prepared payload for a Gravity Forms import.

Gravity Forms is the hub, so a payload prepared from a Gravity Forms form is that form. The conversion this adapter performs is to_universal(); this satisfies the interface every source adapter answers to.

Parameters

NameTypeDefaultDescription
$source_formarrayGravity Forms form.

Returns

  • array

Since: %ver%

Source: src/Platforms/GravityForms/GravityFormsSourceAdapter.php:384