Description
The wsf_action_pdf_filename filter hook can be used to customize the filename of PDF’s generated using the PDF add-on.
The filter applies to PDF’s generated as follows:
- Exported from the submissions admin page.
- Attached to emails when using the Send Email action.
- Created from PDF links.
- Added to Salesforce objects
Usage
add_filter( 'wsf_action_pdf_filename', 'my_hook_function', 10, 3 );
Parameters
$filename
StringThe PDF filename.$form
Form ObjectThe form object.$submit
Submit ObjectThe submit object.
Example
// Callback function for the wsf_action_pdf_filename filter hook function my_hook_function( $filename, $form, $submit ) { // Get the form ID $form_id = $form->id; // Get the submission ID $submit_id = $submit->id; // Build a new filename $filename = sprintf('example-%u-%u.pdf', $form_id, $submit_id); // Return value return $filename; } // Add a callback function for the wsf_action_pdf_filename filter hook add_filter( 'wsf_action_pdf_filename', 'my_hook_function', 10, 3 );
Source File
This hook can be found in:<plugin root>/ws-form-pdf.php