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