bookmark_bordergform_form_pre_results

Description

Use this filter to modify the Form object prior to calculating the results in the results admin page. The results page is currently only used by add-ons that implement the Add-On Framework.

Usage

add_filter( 'gform_form_pre_results', 'your_function_name' );

You can also target a specific form by adding the form id after the hook name. (format: gform_form_pre_results_FORMID)

add_filter( 'gform_form_pre_results_10', 'your_function_name' );

Parameters

  • $form array

    The form object

Examples

This example adds the field id to the field labels.

add_filter( 'gform_form_pre_results', 'modify_results_fields' );
function modify_results_fields( $form ) {
    foreach ( $form['fields'] as &$field ) {
        $field['label'] .= sprintf( " (Field ID: %d)", $field['id'] );
    }
    return $form;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

apply_filters( "gform_form_pre_results_$form_id", apply_filters( 'gform_form_pre_results', $form ) );

This filter is located in GFResults::results_page() and GFResults::ajax_get_results() in includes/addon/class-gf-results.php