Description
The gform_notification_services filter allows you to add a new choice to the Email Service setting on the edit notification page.
Additional code is needed to have the service actually send the notification email, as this hook only makes the option available when configuring notifications.
Usage
The following would apply to all forms.
add_filter( 'gform_notification_services', 'your_function_name' );
| Parameter | Type | Description |
|---|---|---|
| $services | array | An array of notification services. See the example structure below. |
| $form | Form Object | The current form object. |
$services = array(
'wordpress' => array(
'label' => esc_html__( 'WordPress', 'gravityforms' ),
'image' => admin_url( 'images/wordpress-logo.svg' )
)
);
Examples
Add a New Email Service.
add_filter( 'gform_notification_services', 'add_notification_service' );
function add_notification_service( $services ) {
$services['the_service_name'] = array(
'label' => esc_html__( 'Your Custom Service', 'gravityforms' ),
'image' => 'http://someurl.com/image.svg'
);
return $services;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GFNotification::get_notification_services() in notification.php