Skip to main content

GFFormDisplay

Source: form_display.php:10

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
process_form()Starting point for the form submission process. Handles the following tasks: Form validation, save for later logic, entry creation, notification and confirmation.
maybe_add_review_page()Get form object and insert review page, if necessary.
get_state()Gets the value for the state input.
get_state_handler()Returns the state handler.
is_last_page()Determine if the last page for the current form object is being submitted or rendered (depending on the provided $mode).
get_form_theme_slug()Get the slug for the form's theme
get_themes_to_enqueue()Determines which themes to enqueue based on the form context and current page.
post_render_script()Fire the post render events for a form instance when the form is visible on the page.
get_form()Get a form for display.
get_page()Get the markup for a specific page in a multipage form.
get_fields()Get the markup for a colletion of fields in a form. If $page_number is specified, only the markup for the fields on that page will be returned. Otherwise, the markup for all fields in the form will be returned.
get_fields_by_page()Gets the fields for a specific page in a form.
get_submit_button_class()Get the CSS class for the submit button.
get_max_field_id()Get the maximum field ID for the current form.
is_empty()Used to determine the required validation result.
handle_submission()Triggers saving or updating of the entry, spam eval, post creation, sending of notifications, and then returns the confirmation to be used for the current submission.
clean_up_files()Deletes tmp files for the given form.
handle_confirmation()Prepares the confirmation message or redirect to be used by the current submission.
get_confirmation_url()Returns the redirect URL for the current submission.
get_confirmation_message()Gets the confirmation message to be displayed.
get_submission_context()Returns the context for the current submission.
validate()Determines if the current form submission is valid.
validate_field()Validates the submitted value of the given field.
validate_character_encoding()Checks for valid character encoding in the submitted value of the given field.
is_field_validation_supported()Determines if the supplied field is suitable for validation.
is_form_empty()Determines if the current form submission is empty.
failed_state_validation()Determines if the field has been tampered with.
enqueue_scripts()Enqueues scripts/styles for forms embedded via blocks and shortcodes.
parse_forms()Parses the supplied post content for forms embedded via blocks and shortcodes.
parse_forms_from_blocks()Finds forms embedded in the supplied blocks.
parse_forms_from_reusable_block()Finds forms embedded in the supplied reusable block.
parse_forms_from_shortcode()Finds forms embedded in the supplied post content.
is_applicable_form()Determines if the supplied form ID should be added to the found forms array.
get_embedded_forms()Returns forms embedded in the supplied post content.
get_form_enqueue_assets()Get the various enqueueable assets for a given form.
enqueue_form_scripts()Enqueue the required scripts for this form.
add_script_defer()Add defer attribute to Gravity Forms scripts and any script dependent on a Gravity Forms script.
print_form_scripts()Print the required scripts for this form, since we're hooking in after enqueues have processed.
has_image_choices()Check if a form has any Image Choice fields.
has_page_conditional_logic()Determines if the form has page conditional logic.
register_form_init_scripts()Enqueue and retrieve all inline scripts that should be executed when the form is rendered.
get_counter_init_script()Deprecated. No replacement. Text counter settings are rendered as properties to the element in the markup.
get_number_formats_script()Generates a map of fields IDs and their corresponding number formats used by the GFCalc JS object for correctly
has_field_input_mask()Determines if the current field has an input mask.
get_field()Gets the markup for a given field.
get_field_content()
validate_entry_limit()Validates the form's entry limit settings. Returns the entry limit message if entry limit exceeded.
update_confirmation()Populates the form confirmation property with the confirmation to be used for the current submission.
insert_review_page()Insert review page into form.
get_anchor()Get the anchor config for the current form.
is_submit_form_id_valid()Validates the posted input values from the form footer are for the same form, that it exists, is active, and not trashed.
get_submission_method()Returns the safe value of/for the gform_submission_method input.
is_iframe_submission_method()Determines if the iframe-based Ajax submission method is in use.
parse_ajax_input()Parses and sanitizes the value of the gform_ajax input.
prepare_ajax_input_value()Prepares the value for the gform_ajax input.
get_ajax_postback_html()Returns the HTML for the ajax postback.
get_form_not_found_html()Returns the HTML to be be output when the requested form is not found.
get_validation_errors_markup()Generates the markup for the validation errors list that goes on top of the form.
get_validation_errors()Gets a list of validation errors.
convert_legacy_class()Convert legacy ready class to the new equivalent.
validate_form_styles()Parse and validates styles from the gform_default_styles filter.
get_form_styles()Get the form styles from the form parameters and the global style filter.
get_row_spacer()Get the spacer to add to the end of the row, if needed
gform_pre_render()Filters the $form object through the gform_pre_render filter and caches the result so that this filter is only triggered once per request.
flush_cached_forms()Flushes the forms cached by the gform_pre_render method.
get_confirmation_markup()
get_last_page_footer()Gets the last page's footer markup in a multipage form.
get_first_page_header()Gets the first page's header markup in a multipage form.

Method Reference

process_form()

public static function process_form( $form_id, $initiated_by=self::SUBMISSION_INITIATED_BY_API )

Starting point for the form submission process. Handles the following tasks: Form validation, save for later logic, entry creation, notification and confirmation.

Parameters

NameTypeDefaultDescription
$form_idintThe form ID being submitted.
$initiated_byintself::SUBMISSION_INITIATED_BY_APIWhat process initiated the form submission. Possible options are self::SUBMISSION_INITIATED_BY_WEBFORM = 1 or self::SUBMISSION_INITIATED_BY_API = 2.

Since:

  • unknown
  • 2.6.4 (Added the $initiated_by param.)
  • 2.10.0 (Updated to use GFAPI::send_notification() for the form_saved notification.)

Source: form_display.php:53

maybe_add_review_page()

public static function maybe_add_review_page( $form, $partial_entry=[] )

Get form object and insert review page, if necessary.

Parameters

NameTypeDefaultDescription
$formarrayThe current Form object.
$partial_entryarray[]The partial entry from the resumed incomplete submission. Defaults to an empty array.

Returns

  • array — The form object.

Since:

  • 2.1.1.25 (Added $partial_entry parameter.)
  • 1.9.15

Source: form_display.php:334

get_state()

public static function get_state( $form, $field_values, $additional_values=[] )

Gets the value for the state input.

Parameters

NameTypeDefaultDescription
$formarrayThe form being prepared for display.
$field_valuesarrayThe dynamic population values.
$additional_valuesarray[]Additional values to include in the state.

Returns

  • string

Since:

  • unknown
  • 3.0 (Updated to use the state handler and added the $additional_values param.)

Source: form_display.php:459

get_state_handler()

public static function get_state_handler()

Returns the state handler.

Returns

  • Form_Display\State\State_Handler

Since: 3.0

Source: form_display.php:470

is_last_page()

public static function is_last_page( $form, $mode='submit' )

Determine if the last page for the current form object is being submitted or rendered (depending on the provided $mode).

Parameters

NameTypeDefaultDescription
$formarrayA Gravity Forms form object.
$modestring'submit'Mode to check for: 'submit' or 'render'

Returns

  • boolean

Source: form_display.php:673

get_form_theme_slug()

public static function get_form_theme_slug( $form )

Get the slug for the form's theme

Parameters

NameTypeDefaultDescription
$form

Returns

  • string — The theme slug

Since: 2.7

Source: form_display.php:745

get_themes_to_enqueue()

public static function get_themes_to_enqueue( $form, $field_types='' )

Determines which themes to enqueue based on the form context and current page.

Parameters

NameTypeDefaultDescription
$formarrayCurrent form object.
$field_typesstring | array''Optional. If specified, only load themes for forms with fields of these types. Can be a string with a single field type or an array of strings with multiple field types.

Returns

  • array | string[] — Returns an array of theme slugs to enqueue

Since: 2.9

Source: form_display.php:801

post_render_script()

public static function post_render_script( $form_id, $current_page='current_page' )

Fire the post render events for a form instance when the form is visible on the page.

Parameters

NameTypeDefaultDescription
$form_id
$current_page'current_page'

Returns

  • string

Since: 2.8.4

Source: form_display.php:837

get_form()

public static function get_form( $form_id, $display_title=true, $display_description=true, $force_display=false, $field_values=null, $ajax=false, $tabindex=0, $form_theme=null, $style_settings=null )

Get a form for display.

Parameters

NameTypeDefaultDescription
$form_idintThe id of the form.
$display_titlebooltrueWhether to display the form title.
$display_descriptionbooltrueWhether to display the form description.
$force_displayboolfalseWhether to force the form to display even if it is inactive.
$field_valuesarraynullArray of field values.
$ajaxboolfalseWhether ajax is enabled.
$tabindexint0Tabindex for the form.
$form_themestringnullForm theme slug.
$style_settingsstringnullJSON-encoded style settings. Passing false will bypass the gform_default_styles filter.

Returns

Since:

  • unknown
  • 2.7.15 (Added the $form_theme and $style_settings parameters.)

Source: form_display.php:927

get_page()

public static function get_page( $form_id, $page_number, $field_values, $theme, $style_settings, $submission_method )

Get the markup for a specific page in a multipage form.

Parameters

NameTypeDefaultDescription
$form_idintThe form ID.
$page_numberintThe page number to render.
$field_valuesarrayAn array of field values to populate the form with.
$themestringThe current form theme (i.e. orbital or gravity).
$style_settingsarrayAn array of block or shortcode style settings.
$submission_methodstringThe submission method (i.e. ajax or postback).

Returns

  • string — Returns the markup for the specified page of a multipage form.

Since: 2.9.5

Source: form_display.php:1489

get_fields()

public static function get_fields( $form, $field_values, $submitted_values, $page_number=0 )

Get the markup for a colletion of fields in a form. If $page_number is specified, only the markup for the fields on that page will be returned. Otherwise, the markup for all fields in the form will be returned.

Parameters

NameTypeDefaultDescription
$formarrayThe current form object.
$field_valuesarrayThe array of field values to populate the form with.
$submitted_valuesarrayThe array of submitted values if the form has been submitted.
$page_numberint0The current page number to get fields for. Or 0 to get all fields.

Returns

  • string — Returns the markup for the specified page of a multipage form, or all fields in the form if no page number is specified.

Since:

  • 2.9.5
  • 2.9.18 (Made the honeypot the first field on the form.)

Source: form_display.php:1543

get_fields_by_page()

public static function get_fields_by_page( $form, $page_number )

Gets the fields for a specific page in a form.

Parameters

NameTypeDefaultDescription
$formarrayThe form object.
$page_numberintThe page number to get fields for.

Returns

  • array — Returns an array of fields belonging to the specified page.

Since: 2.9.5

Source: form_display.php:1607

get_submit_button_class()

public static function get_submit_button_class( $button, $form_id )

Get the CSS class for the submit button.

Parameters

NameTypeDefaultDescription
$buttonarrayThe button attributes.
$form_idintegerThe ID of the form.

Returns

  • string — The CSS class(es) for this button.

Since: 2.6

Source: form_display.php:1722

get_max_field_id()

public static function get_max_field_id( $form )

Get the maximum field ID for the current form.

Parameters

NameTypeDefaultDescription
$formarrayThe current form object.

Returns

  • int

Since:

  • unknown
  • 1.9.14 (Updated to public access.)
  • 2.4.15 (Updated to use GFFormsModel::get_next_field_id().)

Source: form_display.php:1880

is_empty()

public static function is_empty( $field, $form_id=0, $value=self::ARG_NOT_PROVIDED )

Used to determine the required validation result.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field being validated.
$form_idint0The ID of the form being validated.
$valuenull | string | arrayself::ARG_NOT_PROVIDEDThe value to validate. Defaults to the GFFormDisplay::ARG_NOT_PROVIDED constant, indicating the value should be retrieved from the $_POST.

Returns

  • bool

Since:

  • unknown
  • 3.0 (Added the $value param.)

Source: form_display.php:1902

handle_submission()

public static function handle_submission( &$form, &$lead, $ajax=false )

Triggers saving or updating of the entry, spam eval, post creation, sending of notifications, and then returns the confirmation to be used for the current submission.

Parameters

NameTypeDefaultDescription
&$formarrayThe form being processed.
&$leadarrayThe entry being saved.
$ajaxboolfalseIndicates if ajax is enabled for the form.

Returns

  • string | array

Since:

  • unknown
  • 2.7 (Updated the $form param to pass by reference.)

Source: form_display.php:1937

clean_up_files()

public static function clean_up_files( $form, $is_submission=true )

Deletes tmp files for the given form.

Parameters

NameTypeDefaultDescription
$formarrayThe form the tmp files are to be deleted for.
$is_submissionbooltrueIndicates if tmp files for the current form submission should be deletes as well.

Returns

  • false | void

Since:

  • Unknown
  • 2.8.15 (Added the $is_submission param.)

Source: form_display.php:2126

handle_confirmation()

public static function handle_confirmation( &$form, $entry, $ajax=false, $aux_data=[] )

Prepares the confirmation message or redirect to be used by the current submission.

Parameters

NameTypeDefaultDescription
&$formarrayThe Form Object.
$entryarrayThe Entry Object.
$ajaxboolfalseIf AJAX is being used. Defaults to false.
$aux_dataarray[]Additional data to use when building the confirmation message. Defaults to empty array.

Returns

  • string | array

Since:

  • 2.1.1.11 (Refactored to use GFFormDisplay::get_confirmation_message().)
  • 2.5 (Updated to use GFFormDisplay::get_confirmation_url().)
  • 2.7 (Updated the $form param to pass by reference.)

Source: form_display.php:2196

get_confirmation_url()

public static function get_confirmation_url( $confirmation, $form, $entry )

Returns the redirect URL for the current submission.

Parameters

NameTypeDefaultDescription
$confirmationarrayThe confirmation properties.
$formarrayThe form which was submitted.
$entryarrayThe entry created from the form submission.

Returns

  • string

Since: 2.5

Source: form_display.php:2270

get_confirmation_message()

public static function get_confirmation_message( $confirmation, $form, $entry, $aux_data=[] )

Gets the confirmation message to be displayed.

Parameters

NameTypeDefaultDescription
$confirmationarrayThe Confirmation Object.
$formarrayThe Form Object.
$entryarrayThe Entry Object.
$aux_dataarray[]Additional data to be passed to GFCommon::replace_variables().

Returns

  • string — The confirmation message.

Since: 2.1.1.11

Source: form_display.php:2328

get_submission_context()

public static function get_submission_context()

Returns the context for the current submission.

Returns

  • string

Since: 2.6.4

Source: form_display.php:2378

validate()

public static function validate( &$form, $field_values, $page_number=0, &$failed_validation_page=0 )

Determines if the current form submission is valid.

Parameters

NameTypeDefaultDescription
&$formarrayThe form being processed.
$field_valuesarrayThe dynamic population parameter names and values.
$page_numberint0The current page number.
&$failed_validation_pageint0The page number which has failed validation.

Returns

  • bool

Since:

  • unknown
  • 2.4.19 (Updated to use GFFormDisplay::is_field_validation_supported().)

Source: form_display.php:2403

validate_field()

public static function validate_field( $field, $form, $context, $value=self::ARG_NOT_PROVIDED )

Validates the submitted value of the given field.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field currently being validated.
$formarrayThe form currently being validated.
$contextstringThe context for the current submission. Possible values: form-submit, api-submit, api-validate.
$valuenull | string | arrayself::ARG_NOT_PROVIDEDThe value to validate or null to get the value from the $_POST.

Returns

  • array

Since:

  • 2.7
  • 3.0 (Added the $value param.)

Source: form_display.php:2599

validate_character_encoding()

public static function validate_character_encoding( $result, $value, $field )

Checks for valid character encoding in the submitted value of the given field.

Parameters

NameTypeDefaultDescription
$resultarray{ An array containing the validation result properties.
$valuemixedThe field value currently being validated.
$fieldGF_FieldThe field currently being validated.

Returns

  • array

Since: 2.7.14

Source: form_display.php:2723

is_field_validation_supported()

public static function is_field_validation_supported( $field, $type_check_only=false )

Determines if the supplied field is suitable for validation.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field being processed.
$type_check_onlyboolfalseIndicates if only the field type property should be evaluated.

Returns

  • bool

Since:

  • 2.4.19
  • 2.4.20 (Added the second param.)

Source: form_display.php:2828

is_form_empty()

public static function is_form_empty( $form )

Determines if the current form submission is empty.

Parameters

NameTypeDefaultDescription
$formarrayThe form being processed.

Returns

  • bool

Since:

  • unknown
  • 2.4.19 (Updated to use GFFormDisplay::is_field_validation_supported().)

Source: form_display.php:2848

failed_state_validation()

public static function failed_state_validation( $form_id, $field, $value )

Determines if the field has been tampered with.

Parameters

NameTypeDefaultDescription
$form_idint
$fieldGF_Field
$valuenull | string | array

Returns

  • bool

Since: unknown

Source: form_display.php:2873

enqueue_scripts()

public static function enqueue_scripts()

Enqueues scripts/styles for forms embedded via blocks and shortcodes.

Since:

  • unknown
  • 2.4.18 (Added support for blocks and the gform_post_enqueue_scripts hook.)

Source: form_display.php:2885

parse_forms()

public static function parse_forms( $post_content, &$found_forms, &$found_blocks )

Parses the supplied post content for forms embedded via blocks and shortcodes.

Parameters

NameTypeDefaultDescription
$post_contentstringThe post content to be parsed.
&$found_formsarrayAn array of found forms using the form ID as the key to the ajax status.
&$found_blocksarrayAn array of found GF blocks.

Since: 2.4.18

Source: form_display.php:2937

parse_forms_from_blocks()

public static function parse_forms_from_blocks( $blocks, &$found_forms, &$found_blocks )

Finds forms embedded in the supplied blocks.

Parameters

NameTypeDefaultDescription
$blocksarrayThe blocks found in the post content.
&$found_formsarrayAn array of found forms using the form ID as the key to the ajax status.
&$found_blocksarrayAn array of found GF blocks.

Since: 2.4.18

Source: form_display.php:2960

parse_forms_from_reusable_block()

public static function parse_forms_from_reusable_block( $block, &$found_forms, &$found_blocks )

Finds forms embedded in the supplied reusable block.

Parameters

NameTypeDefaultDescription
$blockarrayThe block to be processed.
&$found_formsarrayAn array of found forms using the form ID as the key to the ajax status.
&$found_blocksarrayAn array of found GF blocks.

Since: 2.4.18

Source: form_display.php:3011

parse_forms_from_shortcode()

public static function parse_forms_from_shortcode( $post_content, &$found_forms )

Finds forms embedded in the supplied post content.

Parameters

NameTypeDefaultDescription
$post_contentstringThe post content to be processed.
&$found_formsarrayAn array of found forms using the form ID as the key to the ajax status.

Since: 2.4.18

Source: form_display.php:3033

is_applicable_form()

public static function is_applicable_form( $form_id, $ajax, $found_forms )

Determines if the supplied form ID should be added to the found forms array.

Parameters

NameTypeDefaultDescription
$form_idintThe form ID to be checked.
$ajaxboolIndicates if Ajax is enabled for the found form.
$found_formsarrayAn array of found forms using the form ID as the key to the ajax status.

Returns

  • bool

Since: 2.4.18

Source: form_display.php:3078

get_embedded_forms()

public static function get_embedded_forms( $post_content, &$ajax )

Returns forms embedded in the supplied post content.

Parameters

NameTypeDefaultDescription
$post_contentstringThe post content to be processed.
&$ajaxboolIndicates if Ajax is enabled for at least one of the forms.

Returns

  • array

Since:

  • unknown
  • 2.4.18 (Updated to use GFFormDisplay::parse_forms_from_shortcode().)

Source: form_display.php:3093

get_form_enqueue_assets()

public static function get_form_enqueue_assets( $form, $theme=null )

Get the various enqueueable assets for a given form.

Parameters

NameTypeDefaultDescription
$formarrayAn array representing the current Form object.
$themestringnullThe theme slug for the form.

Returns

Since:

  • 2.5
  • 2.7 (Added $theme parameter)

Source: form_display.php:3122

enqueue_form_scripts()

public static function enqueue_form_scripts( $form, $ajax=false, $theme=null )

Enqueue the required scripts for this form.

Parameters

NameTypeDefaultDescription
$formarrayAn array representing the current Form object.
$ajaxfalsefalseWhether this is being requested via AJAX.
$themestringnullThe form theme slug.

Returns

  • void

Since: 2.7 (Added the $theme parameter)

Source: form_display.php:3258

add_script_defer()

public static function add_script_defer( $tag, $handle )

Add defer attribute to Gravity Forms scripts and any script dependent on a Gravity Forms script.

Parameters

NameTypeDefaultDescription
$tagstringThe complete script markup that will be output.
$handlestringThe handle of the current script.

Returns

  • string

Since: 2.5

Source: form_display.php:3299

public static function print_form_scripts( $form, $ajax )

Print the required scripts for this form, since we're hooking in after enqueues have processed.

Parameters

NameTypeDefaultDescription
$formarrayAn array representing the current Form object.
$ajaxfalseWhether this is being requested via AJAX.

Returns

  • void

Source: form_display.php:3327

has_image_choices()

public static function has_image_choices( $form )

Check if a form has any Image Choice fields.

Parameters

NameTypeDefaultDescription
$form

Returns

  • mixed | null

Since: 2.8

Source: form_display.php:3370

has_page_conditional_logic()

public static function has_page_conditional_logic( $form )

Determines if the form has page conditional logic.

Parameters

NameTypeDefaultDescription
$formarrayForm object.

Returns

  • bool

Since: 2.5

Source: form_display.php:3429

register_form_init_scripts()

public static function register_form_init_scripts( $form, $field_values=[], $is_ajax=false )

Enqueue and retrieve all inline scripts that should be executed when the form is rendered.

Use add_init_script() function to enqueue scripts.

Parameters

NameTypeDefaultDescription
$formarray
$field_valuesarray[]
$is_ajaxboolfalse

Source: form_display.php:3702

get_counter_init_script()

public static function get_counter_init_script( $form )

Deprecated. No replacement. Text counter settings are rendered as properties to the element in the markup.

To change the counter format, use the gform_text_counter_template filter.

Parameters

NameTypeDefaultDescription
$formarrayThe Form Object

Returns

  • string

Since:

  • Unknown
  • 3.0.0 (Deprecated. No replacement. Text counter settings are rendered as properties to the element in the markup. To change the counter format, use the gform_text_counter_template filter.)

Source: form_display.php:3881

get_number_formats_script()

public static function get_number_formats_script( $form )

Generates a map of fields IDs and their corresponding number formats used by the GFCalc JS object for correctly

converting field values to clean numbers.

  • Number fields have a 'numberFormat' setting (w/ UI).
  • Single-input product fields (i.e. 'singleproduct', 'calculation', 'price' and 'hiddenproduct') should default to the number format of the configured currency.
  • All other product fields will default to 'decimal_dot' for the number format.
  • All other fields will have no format (false) and inherit the format of the formula field when the formula is calculated.

Parameters

NameTypeDefaultDescription
$formmixed

Returns

  • string

Source: form_display.php:3963

has_field_input_mask()

public static function has_field_input_mask( $field )

Determines if the current field has an input mask.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field to be checked.

Returns

  • bool

Source: form_display.php:4187

get_field()

public static function get_field( $field, $value='', $force_frontend_label=false, $form=null, $field_values=null, $page_number=0 )

Gets the markup for a given field.

Parameters

NameTypeDefaultDescription
$fieldGF_FieldThe field object.
$valuestring''The field value to be pre-populated into the field.
$force_frontend_labelboolfalseForces the frontend label to be displayed in the admin even if an admin label is configured. Defaults to false.
$formarraynullThe form object.
$field_valuesarraynullThe array of field values used to pre-populate the form.
$page_numberint0A non-zero value indicates that only that page should be rendered. This affects how page fields are rendered. Defaults to 0.

Returns

  • string | null — Returns the markup for the specified field.

Since: 2.9.5 (Added the optional $page_number parameter.)

Source: form_display.php:4309

get_field_content()

public static function get_field_content( $field, $value='', $force_frontend_label=false, $form_id=0, $form=null )

Parameters

NameTypeDefaultDescription
$fieldGF_Field
$valuestring''
$force_frontend_labelboolfalse
$form_idint0
$formnull | arraynull

Returns

  • string

Source: form_display.php:4568

validate_entry_limit()

public static function validate_entry_limit( $form )

Validates the form's entry limit settings. Returns the entry limit message if entry limit exceeded.

Parameters

NameTypeDefaultDescription
$formarraycurrent GF form object

Returns

  • string | null — If entry limit exceeded returns entry limit setting.

Source: form_display.php:4711

update_confirmation()

public static function update_confirmation( $form, $entry=null, $event='' )

Populates the form confirmation property with the confirmation to be used for the current submission.

Parameters

NameTypeDefaultDescription
$formarrayThe form being processed.
$entrynull | arraynullNull, the entry being processed, or an empty array when the submission fails honeypot validation.
$eventstring''The confirmation event or an empty string.

Returns

  • array

Since:

  • unknown
  • 2.10.0 (Updated to support using a custom confirmation for spam submissions.)

Source: form_display.php:4792

insert_review_page()

public static function insert_review_page( $form, $review_page )

Insert review page into form.

Parameters

NameTypeDefaultDescription
$formarrayThe current Form object
$review_pagearrayThe review page

Returns

  • array — $form

Since: Unknown

Source: form_display.php:5175

get_anchor()

public static function get_anchor( $form, $ajax )

Get the anchor config for the current form.

Parameters

NameTypeDefaultDescription
$formarrayThe current Form object.
$ajaxboolIndicates if AJAX is enabled for the current form.

Returns

  • array

Since: 2.2.2.1

Source: form_display.php:5218

is_submit_form_id_valid()

public static function is_submit_form_id_valid( $ajax_form_id=null )

Validates the posted input values from the form footer are for the same form, that it exists, is active, and not trashed.

Parameters

NameTypeDefaultDescription
$ajax_form_idnull | intnullNull or the form ID parsed from the gform_ajax input value.

Returns

  • bool | int — False or the ID of the form being processed.

Since: 2.4.18

Source: form_display.php:5249

get_submission_method()

public static function get_submission_method( $method='' )

Returns the safe value of/for the gform_submission_method input.

Parameters

NameTypeDefaultDescription
$methodstring''The method or an empty string to get it from the submission.

Returns

  • string

Since: 2.9.2

Source: form_display.php:5287

is_iframe_submission_method()

public static function is_iframe_submission_method()

Determines if the iframe-based Ajax submission method is in use.

Returns

  • bool

Since: 2.9.2

Source: form_display.php:5306

parse_ajax_input()

public static function parse_ajax_input( $bypass_cache=false )

Parses and sanitizes the value of the gform_ajax input.

Parameters

NameTypeDefaultDescription
$bypass_cacheboolfalseIndicates if the cached arguments should be ignored. Default is false.

Returns

  • array | false

Since: 2.9.2

Source: form_display.php:5319

prepare_ajax_input_value()

public static function prepare_ajax_input_value( $form_id, $display_title, $display_description, $tabindex, $theme=null, $styles=null, $include_hash=true )

Prepares the value for the gform_ajax input.

Parameters

NameTypeDefaultDescription
$form_idintThe form ID.
$display_titleboolIndicates if display of the form title is enabled.
$display_descriptionboolIndicates if display of the form description is enabled.
$tabindexintThe starting tabindex.
$themenull | stringnullNull or the name of the form theme.
$stylesnull | stringnullNull or the JSON encoded form styles.
$include_hashbooltrueIndicates if the hash should be included.

Returns

  • string

Since: 2.9.2

Source: form_display.php:5386

get_ajax_postback_html()

public static function get_ajax_postback_html( $body_content )

Returns the HTML for the ajax postback.

Parameters

NameTypeDefaultDescription
$body_contentstringThe content to be included in the body of the ajax postback.

Returns

  • string

Since: 2.4.18

Source: form_display.php:5413

get_form_not_found_html()

public static function get_form_not_found_html( $form_id, $ajax=false )

Returns the HTML to be be output when the requested form is not found.

Parameters

NameTypeDefaultDescription
$form_idint | stringThe ID or Title of the form requested for display.
$ajaxboolfalseWhether to return the html as part of the ajax postback html or on its own.

Returns

  • string

Since:

  • 2.5.7 (Added the $ajax argument.)
  • 2.4.18

Source: form_display.php:5437

get_validation_errors_markup()

public static function get_validation_errors_markup( $form, $values, $show_summary=false )

Generates the markup for the validation errors list that goes on top of the form.

Parameters

NameTypeDefaultDescription
$formarrayCurrent form being displayed.
$valuesarraySubmitted values.
$show_summaryboolfalseWhether to show a summary of validation errors or just show the validation message.

Returns

  • string — Validation errors markup.

Since: 2.5

Source: form_display.php:5464

get_validation_errors()

public static function get_validation_errors( $form, $values )

Gets a list of validation errors.

Parameters

NameTypeDefaultDescription
$formarrayCurrent form being displayed.
$valuesarraySubmitted values.

Returns

  • array — List of validation errors for each field, each item contains the error message and its corresponding field label and selector.

Since:

  • 2.5
  • 2.9.18 (Added support for getting the message from the field validation_summary_message context property.)
  • 3.0 (Updated to support the repeater field.)

Source: form_display.php:5530

convert_legacy_class()

public static function convert_legacy_class( $form, $classes )

Convert legacy ready class to the new equivalent.

Parameters

NameTypeDefaultDescription
$formarrayThe current form object.
$classesstringThe class or classes to convert.

Returns

  • string | void

Since: 2.5

Source: form_display.php:5583

validate_form_styles()

public static function validate_form_styles( $styles )

Parse and validates styles from the gform_default_styles filter.

Parameters

NameTypeDefaultDescription
$stylesmixedArray or JSON string of styles.

Returns

  • array | bool | null — $styles

Since: 2.7.15

Source: form_display.php:5623

get_form_styles()

public static function get_form_styles( $style_settings )

Get the form styles from the form parameters and the global style filter.

Parameters

NameTypeDefaultDescription
$style_settingsarray | stringArray or JSON string of styles.

Returns

  • array | false | string

Since: 2.7.15

Source: form_display.php:5673

get_row_spacer()

public static function get_row_spacer( $field, $form )

Get the spacer to add to the end of the row, if needed

Parameters

NameTypeDefaultDescription
$fieldarrayThe current field object.
$formarrayThe current form object.

Returns

  • string

Since: 2.8.2

Source: form_display.php:5736

gform_pre_render()

public static function gform_pre_render( $form, $context, $ajax=null, $field_values=null )

Filters the $form object through the gform_pre_render filter and caches the result so that this filter is only triggered once per request.

Parameters

NameTypeDefaultDescription
$formarrayThe form object being filtered.
$contextstringThe context that the method is being called in. Possible values are 'form_display' and 'form_config'.
$ajaxbool | nullnullWhether the form is being displayed via AJAX. Only used when $context is 'form_display'.
$field_valuesarray | nullnullThe field values to be used to populate the form. Only used when $context is 'form_display'.

Returns

  • array — Returns the form object after being filtered by the gform_pre_render filter.

Since: 2.9.0

Source: form_display.php:5773

flush_cached_forms()

public static function flush_cached_forms( $cache_key=null )

Flushes the forms cached by the gform_pre_render method.

Parameters

NameTypeDefaultDescription
$cache_keystringnullThe cache key to flush. The format is FORM-ID_CONTEXT. Defaults to null and if not provided, all cached forms will be flushed.

Returns

  • void

Since: 2.9.0

Source: form_display.php:5804

get_confirmation_markup()

public static function get_confirmation_markup( $form, $confirmation_message, $ajax, $style_settings=false, $form_theme=null )

Parameters

NameTypeDefaultDescription
$formarray
$confirmation_messagestring
$ajaxbool
$style_settingsfalse
$form_themenull

Returns

  • mixed

Source: form_display.php:5818

public static function get_last_page_footer( $form, $label_placement, $ajax, $field_values, $display_title, $display_description, $tabindex, $form_theme, $style_settings, $submission_method )

Gets the last page's footer markup in a multipage form.

Parameters

NameTypeDefaultDescription
$formarrayThe current form object.
$label_placementstringThe label placement setting for the form.
$ajaxboolIndicates if AJAX is enabled for the current form.
$field_valuesarrayThe field values to be used to populate the form.
$display_titleboolIndicates if the form title should be displayed.
$display_descriptionboolIndicates if the form description should be displayed.
$tabindexintThe starting tabindex.
$form_themestringThe theme selected for the form.
$style_settingsstringThe styles for the form.
$submission_methodstringThe submission method for the form.

Returns

  • string — Returns the markup for the last page's footer.

Since: 2.9.5

Source: form_display.php:5898

get_first_page_header()

public static function get_first_page_header( $form )

Gets the first page's header markup in a multipage form.

Parameters

NameTypeDefaultDescription
$formarrayThe current form object.

Returns

  • string — Returns the markup for the first page's header.

Since: 2.9.5

Source: form_display.php:5924