gform_form_pre_results

gform_form_pre_results

DescriptionUsageParametersExamplesPlacementSource Code

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
1add_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)
1add_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.
1234567add_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
1apply_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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注