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
| Method | Description |
|---|---|
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
| Name | Type | Default | Description |
|---|---|---|---|
$confirmation | array | Confirmation, 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
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | What it is called. | |
$message | string | The 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
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | What it is called. | |
$url | string | Where 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
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | What it is called. | |
$page_id | int | string | Which 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
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | Label. |
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
| Name | Type | Default | Description |
|---|---|---|---|
$active | bool | Active. |
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
| Name | Type | Default | Description |
|---|---|---|---|
$is_default | bool | Whether 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
| Name | Type | Default | Description |
|---|---|---|---|
$query_string | string | Query string. |