gravityflowpdf_file_name
Use this filter to change the name of the PDF file generated via the PDF Generator Add-On.
Parameters
$file_name string
The file name
$entry_id integer
The Entry ID
$form_id integer
The Form ID
Example 1
This example adds a prefix to the the name of the file.
add_filter( 'gravityflowpdf_file_name', 'sh_gravityflowpdf_file_name', 10, 3 ); function sh_gravityflowpdf_file_name( $file_name, $entry_id, $form_id ) { return 'my-pdf-' . $file_name; }
Example 2
This example adds a prefix of the Step ID to the the name of the file for certain steps.
add_filter( 'gravityflowpdf_file_name', 'sh_filename_with_step', 10, 3 ); function sh_filename_with_step( $file_name, $entry_id, $form_id ) { $api = new Gravity_Flow_API( $form_id ); $entry = GFAPI::get_entry( $entry_id ); $step = $api->get_current_step( $entry ); if( $step->get_id() == '3' ) { $file_name = 'step-' . $step->get_id() . '-' . $file_name; } return $file_name; }
Placement
This code should be placed in the functions.php file of your active theme.