Skip to main content

GravityKit\GravityMigrate\Schema\UniversalConfirmation

What a form shows or does after a submission, in terms no single platform owns.

Every form plugin answers the same question after a submission: show something, go somewhere, or load a page. They disagree only on spelling. Gravity Forms keys a confirmation by id and calls the target url or pageId; Ninja keeps success_msg on one action and redirect_url on another; Formidable writes success_action and reads success_msg, success_url or success_page_id depending on it.

Those spellings belong in each platform's definition. What belongs here is the shape they all share.

A confirmation cannot be built in an invalid state: a redirect without a url and a page confirmation without a page are unconstructable rather than merely wrong.

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:27

Details

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

Methods

MethodDescription
to_array()The confirmation as plain data, in this model's vocabulary rather than any platform's.
from_array()Reads a confirmation back.
message()A confirmation that shows text in place of the form.
redirect()A confirmation that sends the browser elsewhere.
page()A confirmation that loads another page of this site.
get_label()What this confirmation is called.
set_label()Renames it.
is_active()Whether it runs.
set_active()Turns it on or off.
is_default()Whether this is the fallback when no condition picks another.
set_default()Marks it as the fallback.
get_type()Which of the three things this confirmation does.
is_message()Whether it shows text.
is_redirect()Whether it sends the browser elsewhere.
is_page()Whether it loads another page.
get_message()The text shown; empty unless this is a message confirmation.
get_url()Where the browser is sent; empty unless this is a redirect.
get_page_id()Which page is loaded; zero unless this is a page confirmation.
get_query_string()What is appended to the destination.
set_query_string()Appends something to the destination.
get_conditional_logic()When this confirmation is chosen.
has_conditional_logic()Whether this runs only under conditions.
set_conditional_logic()Sets when it is chosen.
extras()What one platform keeps here that the shape above has no room for.

Method Reference

to_array()

public function to_array(): array

The confirmation as plain data, in this model's vocabulary rather than any platform's.

Only the destination the type calls for is written. A url left on a message confirmation is invisible until somebody switches it to a redirect, and then it sends them somewhere stale.

Returns

  • array

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:69

from_array()

public static function from_array( array $confirmation ): self

Reads a confirmation back.

An unrecognised type reads as a message, the one of the three that needs nothing beyond text and so cannot produce a confirmation pointing nowhere.

Parameters

NameTypeDefaultDescription
$confirmationarrayConfirmation, in the shape to_array() writes.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:103

message()

public static function message( string $label, string $message ): self

A confirmation that shows text in place of the form.

Parameters

NameTypeDefaultDescription
$labelstringWhat it is called.
$messagestringThe text shown.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:248

redirect()

public static function redirect( string $label, string $url ): ?self

A confirmation that sends the browser elsewhere.

Parameters

NameTypeDefaultDescription
$labelstringWhat it is called.
$urlstringWhere to go.

Returns

  • self | null — Null when there is nowhere to go, which is not a redirect.

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:266

page()

public static function page( string $label, $page_id ): ?self

A confirmation that loads another page of this site.

Parameters

NameTypeDefaultDescription
$labelstringWhat it is called.
$page_idint | stringWhich page.

Returns

  • self | null — Null when no page is named, which is not a page confirmation.

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:290

get_label()

public function get_label(): string

What this confirmation is called.

Returns

  • string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:311

set_label()

public function set_label( string $label ): self

Renames it.

Parameters

NameTypeDefaultDescription
$labelstringLabel.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:324

is_active()

public function is_active(): bool

Whether it runs.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:337

set_active()

public function set_active( bool $active ): self

Turns it on or off.

Parameters

NameTypeDefaultDescription
$activeboolActive.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:350

is_default()

public function is_default(): bool

Whether this is the fallback when no condition picks another.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:363

set_default()

public function set_default( bool $is_default ): self

Marks it as the fallback.

Parameters

NameTypeDefaultDescription
$is_defaultboolWhether it is the default.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:376

get_type()

public function get_type(): string

Which of the three things this confirmation does.

Returns

  • string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:389

is_message()

public function is_message(): bool

Whether it shows text.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:400

is_redirect()

public function is_redirect(): bool

Whether it sends the browser elsewhere.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:411

is_page()

public function is_page(): bool

Whether it loads another page.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:422

get_message()

public function get_message(): string

The text shown; empty unless this is a message confirmation.

Returns

  • string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:433

get_url()

public function get_url(): string

Where the browser is sent; empty unless this is a redirect.

Returns

  • string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:444

get_page_id()

public function get_page_id()

Which page is loaded; zero unless this is a page confirmation.

Returns

  • int | string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:455

get_query_string()

public function get_query_string(): string

What is appended to the destination.

Returns

  • string

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:466

set_query_string()

public function set_query_string( string $query_string ): self

Appends something to the destination.

Parameters

NameTypeDefaultDescription
$query_stringstringQuery string.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:479

get_conditional_logic()

public function get_conditional_logic(): ?UniversalConditionalLogic

When this confirmation is chosen.

Returns

  • UniversalConditionalLogic | null

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:492

has_conditional_logic()

public function has_conditional_logic(): bool

Whether this runs only under conditions.

Returns

  • bool

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:503

set_conditional_logic()

public function set_conditional_logic( ?UniversalConditionalLogic $logic ): self

Sets when it is chosen.

Parameters

NameTypeDefaultDescription
$logicUniversalConditionalLogic | nullConditional logic, or null for none.

Returns

  • self

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:516

extras()

public function extras(): ExtensionData

What one platform keeps here that the shape above has no room for.

Returns

  • ExtensionData

Since: %ver%

Source: src/Schema/UniversalConfirmation.php:529