Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
Jump To Section

Description #description

This filter can be used to programically enable or disable a PDF configured on the form. By default, Gravity PDF will check if the PDF status is active and the conditional logic is valid. This hook allows you to filter PDFs with advanced logic.

Version #version

This filter was introduced in Gravity PDF 4.2.

Parameters #parameters

$filtered | array
The filtered list of PDF settings
$pdfs | array
The unfiltered list of PDF settings
$entry | array
The raw Gravity Form Entry array.
$form | array
The Gravity Forms array

Usage #usage

Use the following code to enable the form’s PDFs if two sets of conditions are true (something you cannot do with standard Gravity Forms conditional logic), otherwise disable the documents:

add_filter( 'gfpdf_get_active_pdfs', function( $filtered, $pdfs, $entry, $form ) {

    if ( ( $entry[1] === 'Australia' || $entry[1] === 'New Zealand' ) && $entry[2] === 'Married' ) {
        return $pdfs;
    }

    return [];
}, 10, 3 );

Source Code #source-code

This filter is located in the Model_PDF::get_active_pdfs() method in /src/model/Model_PDF.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top

Choose your currency:

Close
Converted prices are for reference only - all orders are charged in $ Australian Dollars ($) AUD.
  • AUDAustralian Dollars ($)
  • USDUS Dollars ($)
  • CADCanadian Dollars ($)
  • EUREuros (€)
  • GBPPound Sterling (£)
  • NZDNew Zealand Dollar ($)
  • JPYJapanese Yen (¥)