GravityKit\GravityMigrate\Schema\UniversalNotification
A message a form sends, in terms no single platform owns.
Every form plugin describes a notification with the same fourteen things: what it is called, whether it runs, what triggers it, who it goes to, cc, bcc, the sender's name and address, a reply-to, a subject, a body, whether that body is HTML, whether uploads ride along, and when to send it at all. They disagree only on spelling, and the spellings belong in each platform's definition.
Two slots are named types rather than loose values. The recipient is a Recipient, because "who" is three different things and reading one as another sends mail nowhere. The trigger is a closed set, because Gravity Forms can send partway through a multi-page form and most platforms cannot, which is a difference somebody has to be told about.
Anything one platform keeps that the shape has no room for goes in extras, so it survives the trip home instead of being dropped on the way.
Since: %ver%
Source: src/Schema/UniversalNotification.php:29
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
to_array() | The notification as plain data, in this model's vocabulary rather than any platform's. |
from_array() | Reads a notification back. |
email() | A message the form sends. |
get_label() | What it is called. |
set_label() | Renames it. |
is_active() | Whether it sends. |
set_active() | Turns it on or off. |
get_event() | What triggers it. |
set_event() | Sets the trigger. |
has_unusual_event() | Whether this sends on something other than a normal submission. |
get_to() | Who it goes to. |
set_to() | Changes who it goes to. |
get_cc() | Who else, openly. |
set_cc() | Sets who else, openly. |
get_bcc() | Who else, privately. |
set_bcc() | Sets who else, privately. |
get_from_name() | The name it appears to come from. |
set_from_name() | Sets the name it appears to come from. |
get_from_address() | The address it appears to come from. |
set_from_address() | Sets the address it appears to come from. |
get_reply_to() | Where a reply goes. |
set_reply_to() | Sets where a reply goes. |
get_subject() | The subject line. |
set_subject() | Sets the subject line. |
get_body() | The message body. |
set_body() | Sets the message body. |
get_format() | Whether the body is HTML or plain text. |
is_html() | Whether the body is HTML. |
set_format() | Sets whether the body is HTML or plain text. |
attaches_uploads() | Whether uploaded files are attached. |
set_attach_uploads() | Sets whether uploaded files are attached. |
get_conditional_logic() | When it sends at all. |
has_conditional_logic() | Whether this runs only under conditions. |
set_conditional_logic() | Sets when it sends. |
extras() | What one platform keeps here that the shape above has no room for. |
Method Reference
to_array()
public function to_array(): array
The notification as plain data, in this model's vocabulary rather than any platform's.
Returns
array
Since: %ver%
Source: src/Schema/UniversalNotification.php:75
from_array()
public static function from_array( array $notification ): self
Reads a notification back.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$notification | array | Notification, in the shape to_array() writes. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:104
email()
public static function email( string $label, Recipient $to, string $subject, string $body ): self
A message the form sends.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | What it is called. | |
$to | Recipient | Who it goes to. | |
$subject | string | Subject line. | |
$body | string | Message body. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:297
get_label()
public function get_label(): string
What it is called.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:308
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/UniversalNotification.php:321
is_active()
public function is_active(): bool
Whether it sends.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalNotification.php:334
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/UniversalNotification.php:347
get_event()
public function get_event(): string
What triggers it.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:360
set_event()
public function set_event( string $event ): self
Sets the trigger.
An unrecognised trigger falls back to submission rather than being stored, because a platform that cannot express the original will send on submission anyway; recording something it will never honour would only look like it worked.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$event | string | One of the EVENTS. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:377
has_unusual_event()
public function has_unusual_event(): bool
Whether this sends on something other than a normal submission.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalNotification.php:390
get_to()
public function get_to(): Recipient
Who it goes to.
Returns
Recipient
Since: %ver%
Source: src/Schema/UniversalNotification.php:401
set_to()
public function set_to( Recipient $to ): self
Changes who it goes to.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$to | Recipient | Recipient. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:414
get_cc()
public function get_cc(): string
Who else, openly.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:427
set_cc()
public function set_cc( string $cc ): self
Sets who else, openly.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$cc | string | Addresses. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:440
get_bcc()
public function get_bcc(): string
Who else, privately.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:453
set_bcc()
public function set_bcc( string $bcc ): self
Sets who else, privately.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$bcc | string | Addresses. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:466
get_from_name()
public function get_from_name(): string
The name it appears to come from.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:479
set_from_name()
public function set_from_name( string $from_name ): self
Sets the name it appears to come from.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$from_name | string | Sender name. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:492
get_from_address()
public function get_from_address(): string
The address it appears to come from.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:505
set_from_address()
public function set_from_address( string $from_address ): self
Sets the address it appears to come from.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$from_address | string | Sender address. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:518
get_reply_to()
public function get_reply_to(): string
Where a reply goes.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:531
set_reply_to()
public function set_reply_to( string $reply_to ): self
Sets where a reply goes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$reply_to | string | Reply-to address. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:544
get_subject()
public function get_subject(): string
The subject line.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:557
set_subject()
public function set_subject( string $subject ): self
Sets the subject line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$subject | string | Subject. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:570
get_body()
public function get_body(): string
The message body.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:583
set_body()
public function set_body( string $body ): self
Sets the message body.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$body | string | Body. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:596
get_format()
public function get_format(): string
Whether the body is HTML or plain text.
Returns
string
Since: %ver%
Source: src/Schema/UniversalNotification.php:609
is_html()
public function is_html(): bool
Whether the body is HTML.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalNotification.php:620
set_format()
public function set_format( string $format ): self
Sets whether the body is HTML or plain text.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$format | string | One of the FORMAT constants. Anything but FORMAT_PLAIN reads as HTML, which is what a platform that does not say assumes. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:634
attaches_uploads()
public function attaches_uploads(): bool
Whether uploaded files are attached.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalNotification.php:647
set_attach_uploads()
public function set_attach_uploads( bool $attach ): self
Sets whether uploaded files are attached.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$attach | bool | Whether to attach. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:660
get_conditional_logic()
public function get_conditional_logic(): ?UniversalConditionalLogic
When it sends at all.
Returns
UniversalConditionalLogic|null
Since: %ver%
Source: src/Schema/UniversalNotification.php:673
has_conditional_logic()
public function has_conditional_logic(): bool
Whether this runs only under conditions.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalNotification.php:684
set_conditional_logic()
public function set_conditional_logic( ?UniversalConditionalLogic $logic ): self
Sets when it sends.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$logic | UniversalConditionalLogic | null | Conditional logic, or null for none. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalNotification.php:697
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/UniversalNotification.php:710