Using Gravity Forms ‘gform_notification_settings_fields’ PHP filter

The gform_notification_settings_fields filter allows you to customize the available settings on the Notification configuration page in Gravity Forms.

Usage

To use the filter for all forms:

add_filter('gform_notification_settings_fields', 'your_function_name', 10, 3);

To target a specific form, add the form ID after the hook name:

add_filter('gform_notification_settings_fields_6', 'your_function_name', 10, 3);

Parameters

  • $fields (array) – The Form Settings fields. Refer to the Settings API for details on how the fields are defined.
  • $notification (Notification Object) – The meta for the form notification being viewed/edited.
  • $form (Form Object) – The current form.

More information

See Gravity Forms Docs: gform_notification_settings_fields

Examples

Add a new hidden field

Add a hidden field to the notification configuration page:

add_filter('gform_notification_settings_fields', function ($fields, $notification, $form) {
    $fields[0]['fields'][] = array('type' => 'hidden', 'name' => 'my_custom_hidden_field');
    return $fields;
}, 10, 3);

Add a custom text field

Add a custom text field to the notification configuration page:

add_filter('gform_notification_settings_fields', function ($fields, $notification, $form) {
    $fields[0]['fields'][] = array(
        'type' => 'text',
        'name' => 'my_custom_text_field',
        'label' => 'Custom Text Field',
        'tooltip' => 'This is a custom text field.'
    );
    return $fields;
}, 10, 3);

Add a dropdown field

Add a dropdown field with options to the notification configuration page:

add_filter('gform_notification_settings_fields', function ($fields, $notification, $form) {
    $fields[0]['fields'][] = array(
        'type' => 'select',
        'name' => 'my_custom_dropdown_field',
        'label' => 'Custom Dropdown Field',
        'choices' => array(
            array('label' => 'Option 1', 'value' => 'option1'),
            array('label' => 'Option 2', 'value' => 'option2')
        )
    );
    return $fields;
}, 10, 3);

Add a checkbox field

Add a checkbox field with options to the notification configuration page:

add_filter('gform_notification_settings_fields', function ($fields, $notification, $form) {
    $fields[0]['fields'][] = array(
        'type' => 'checkbox',
        'name' => 'my_custom_checkbox_field',
        'label' => 'Custom Checkbox Field',
        'choices' => array(
            array('label' => 'Option 1', 'value' => 'option1'),
            array('label' => 'Option 2', 'value' => 'option2')
        )
    );
    return $fields;
}, 10, 3);