Gravity_Forms\Gravity_Forms\Messages\Dismissable_Messages
Source: includes/messages/class-dismissable-messages.php:5
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Messages
Methods
| Method | Description |
|---|---|
add_internal() | Add an internal (one we manage within the codebase) dismissible message to the array of dismissible messages. |
add() | Add a dismissible message to the array of dismissible messages. |
remove() | Remove a dismissible message from the array of sticky dismissible messages. |
display() | Outputs dismissible messages on the page. |
dismiss() | Adds a dismissible message to the user meta of the current user so it's not displayed again. |
ajax_dismiss() | Target for the wp_ajax_gf_dismiss_message ajax action requested from the Gravity Forms admin pages. |
Method Reference
add_internal()
public function add_internal( $key, $type='warning', $capabilities=false, $sticky=false, $page=null )
Add an internal (one we manage within the codebase) dismissible message to the array of dismissible messages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | ||
$type | string | 'warning' | |
$capabilities | string | array | bool | false | A string containing a capability. Or an array or capabilities. Or FALSE for no capability check. |
$sticky | bool | false | Whether to keep displaying the message until it's dismissed. |
$page | string | null | null | The page on which to display the sticky message. NULL will display on all pages available. |
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:20
add()
public function add( $text, $key, $type='warning', $capabilities=false, $sticky=false, $page=null )
Add a dismissible message to the array of dismissible messages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$text | string | ||
$key | string | ||
$type | string | 'warning' | |
$capabilities | string | array | bool | false | A string containing a capability. Or an array or capabilities. Or FALSE for no capability check. |
$sticky | bool | false | Whether to keep displaying the message until it's dismissed. |
$page | string | null | null | The page on which to display the sticky message. NULL will display on all pages available. |
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:42
remove()
public function remove( $key )
Remove a dismissible message from the array of sticky dismissible messages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string |
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:69
display()
public function display( $messages=false, $page=null )
Outputs dismissible messages on the page.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$messages | array | bool | false | A predetermined set of messages to display instead of retrieving them. |
$page | string | null | null | Defaults to current Gravity Forms page from \GFForms::get_page(). |
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:124
dismiss()
public function dismiss( $key )
Adds a dismissible message to the user meta of the current user so it's not displayed again.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The message key. |
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:213
ajax_dismiss()
public function ajax_dismiss()
Target for the wp_ajax_gf_dismiss_message ajax action requested from the Gravity Forms admin pages.
Returns
void
Since: 2.5.7
Source: includes/messages/class-dismissable-messages.php:255