Match against form IDs when using the Search Forms feature.
// Allow searching of forms by ID in form list table
add_filter( 'gform_form_list_forms', function( $forms, $search_query, $active, $sort_column, $sort_direction, $trash ) {
if ( ctype_digit( $search_query ) ) {
if ( GFAPI::get_form( (int) $search_query ) ) {
$form = array_values( array_filter( GFFormsModel::get_forms(), function( $form ) use ( $search_query ) {
return $form->id == (int) $search_query;
} ) );
if ( count( $forms ) === 0 ) {
$forms = $form;
} else {
$forms[] = $form[0];
}
}
}
return $forms;
}, 10, 6 );