gravityflowpdf_download_file_name

Use this filter to change the name of the downloadable PDF file via the merge tag.

Parameters

$name string
The filename

$entry_id integer
The Entry ID

$form_id integer
The Form ID

Example 1

This example adds a prefix to the name of the file.

add_filter( 'gravityflowpdf_download_file_name', 'sh_gravityflowpdf_download_file_name', 10, 3 );  
function sh_gravityflowpdf_download_file_name( $name, $entry_id, $form_id ) {
      return 'my-pdf-' . $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_download_file_name', 'sh_downloadfilename_with_step', 10, 3 );
function sh_downloadfilename_with_step( $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' ) {
              $name = 'step-' . $step->get_id() . '-' . $name;
       }

       return $name;
}

Placement

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