PDF Form Submissions hooks examples


All the code examples linked by title of hooks are to be found at – https://gist.github.com/New0/745133d102fe05110d1429603e9177bb

caldera_forms_pdf_content 🔗

Filters the HTML being converted to PDF. Returns a string of HTML and passes the $entry_id and $form_id as two more parameters.

caldera_forms_api_allow_pdf_download 🔗

Control how it is allowed to download the PDF files, the request is passed as a parameter and returns a boolean.

caldera_forms_pdf_attachment_filename 🔗

This filters the name of the PDF file attached to emails. Two parameters are added after $filename, $entry_id and $form_id.

It returns a $filename as “filename” ( securely created by default ). The “.pdf”extension is already printed after the filename.

caldera_forms_pdf_upload_dir 🔗

This filters the temporary folder used to create the PDF File for attachments, wp-content/uploads/cf-pdf. By default, the file is deleted as soon as the email is sent. Changing the folder via this hook will keep the file in the system or require working on deletion.

Three parameters are passed, $upload_dir is the result of wp_upload_dir(); then $entry_id and $form_id.

It returns a $pdf_upload_dir ( securely created by default ).

caldera_forms_pdf_download_filename 🔗

Controls the filename of PDF files being downloaded ( via entry viewer or link after submission). $entry_id and $form_id parameters are passed.

Returns a $filename as “filename.pdf”

caldera_forms_pdf_download_link_icon 🔗

Control the attributes passed to the image in the Download link displayed after Forms Submissions. Returns an array of $attributes, including src to change the image. The $form configuration is passed as a parameter.

caldera_forms_pdf_download_link_markup 🔗

Controls the Download link displayed after Form submissions. Return a string of HTML. $href, $img, $form, $transdata  are passed as parameters.

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More