gform_review_page

gform_review_page

DescriptionUsageParametersExamplesExample 1Example 2PlacementSource Code

Description
This filter is executed before the form is displayed and can be used to insert a review page before the final form submission.
Usage
The following would apply to all forms.
add_filter( 'gform_review_page', 'your_function_name' );

To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_review_page_FORMID)
add_filter( 'gform_review_page_6', 'your_function_name' );

Parameters

$review_page array
The review page to be created.
array(
'content' => '',
'cssClass' => '',
'is_enabled' => false,
'nextButton' => array(
'type' => 'text',
'text' => __( 'Review Form', 'gravityforms' ),
'imageUrl' => '',
'imageAlt' => '',
),
'previousButton' => array(
'type' => 'text',
'text' => __( 'Previous', 'gravityforms' ),
'imageUrl' => '',
'imageAlt' => '',
),
);

$form Form Object
The current form.

$entry bool|Entry Object
False or the current entry.

Examples
Example 1
This example enables the review page and populates it with the {all_fields} merge tag.
add_filter( 'gform_review_page', 'add_review_page', 10, 3 );
function add_review_page( $review_page, $form, $entry ) {

// Enable the review page
$review_page['is_enabled'] = true;

if ( $entry ) {
// Populate the review page.
$review_page['content'] = GFCommon::replace_variables( '{all_fields}', $form, $entry );
}

return $review_page;
}

Example 2
This example changes the text of the 「Review Form」 button.
// NOTE: Update the '221' to the ID of your form.
add_filter( 'gform_review_page_222', 'change_review_page_button', 10, 3 );
function change_review_page_button( $review_page, $form, $entry ) {

$review_page['nextButton']['text'] = 'Review & Submit';

return $review_page;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_review_page', $form['id'], $review_page, $form, $partial_entry );
This filter is located in GFFormDisplay::maybe_add_review_page() in form_display.php

发表回复

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