gform_form_list_forms

Description

The “gform_form_list_forms” filter in Gravity Forms allows the forms displayed on the form listing page to be filtered. It should be used in conjunction with the gform_form_list_count hook to adjust the counts.

Usage

add_filter( 'gform_form_list_forms', 'your_function_name', 10, 6 );

Parameters

  • $forms array

    The complete list of forms.

  • $search_query string

    The search query string if set.

  • $active bool

    If inactive forms should be displayed.

  • $sort_column string

    List column being sorted.

  • sort_direction string

    Direction of column sorting.

  • trash bool

    If trash items should be displayed.

Examples

add_filter( 'gform_form_list_forms', 'filter_forms', 10, 6 );
function filter_forms( $forms, $search_query, $active, $sort_column, $sort_direction, $trash ){
    //remove half of the forms
    $forms = array_slice( $forms,0, round( count($forms)/2 ) );
  	return $forms;
}

Placement

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

Since

This filter was added in Gravity Forms version 2.3.

Source Code

This filter is located in GF_Form_List_Table::prepare_items() in form_list.php.