Description
Use the filter to add/remove fields from the list of email fields that get displayed on the Notification edit page when configuring the “Send To Field”.
Usage
add_filter( 'gform_email_fields_notification_admin', 'add_field_to_email_list', 10, 2 );
Applies to a specific form. In this case, form id 5.
add_filter( 'gform_email_fields_notification_admin_5', 'add_field_to_email_list', 10, 2 );
Parameters
- $field_list array
And array of Field Objects to be displayed in the drop down.
-
$form Form Object
The current form.
Examples
The following example adds a field (field with ID=1) to the list of email fields displayed in the drop down.
add_filter( 'gform_email_fields_notification_admin', 'add_field_to_email_list', 10, 2 ); function add_field_to_email_list( $field_list, $form ) { //Adds field with ID=1 to the list of email fields foreach ( $form['fields'] as $field ) { if ( $field->id == '1' ) { $field_list[] = $field; break; } } return $field_list; }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFNotification::get_notification_ui_settings() in notification.php.