spivurno
12/12/2014 - 9:36 PM

Gravity Wiz // Gravity Forms // Allow filtering of entries where no checkbox is selected on the Entry List and Entry Export views.

Gravity Wiz // Gravity Forms // Allow filtering of entries where no checkbox is selected on the Entry List and Entry Export views.

/**
 * Gravity Wiz // Gravity Forms // Allow filtering of entries where no checkbox is selected on the Entry List and Entry Export views.
 */
add_filter( 'gform_form_post_get_meta', function( $form ) {

	$page = GFForms::get_page();
	$is_export_action = rgpost( 'action' ) == 'rg_select_export_form';

	if( $page != 'entry_list' && ! $is_export_action ) {
		return $form;
	}

	foreach( $form['fields'] as &$field ) {
		if( GFFormsModel::get_input_type( $field ) == 'checkbox' ) {
			$choices = $field['choices'];
			$choices[] = array(
				'text' => '',
				'value' => ''
			);
			$field['choices'] = $choices;
		}
	}

	return $form;
} );