Skip to main content
Version: 4

Gravity PDF API – get_pdf()

Jump To Section

Description

This method will return an array containing an individual PDF's settings on a particular Gravity Form.

Version

This method was introduced in Gravity PDF 4.0.

Parameters

$form_id | integer : The Gravity Form ID

$pdf_id | string : The PDF internal identifier (found in the pid URL parameter when viewing individual PDF settings in the admin area)

Return

array | WP_Error : An array of the PDF settings will be returned on success, otherwise a WP_Error object on failure

Usage

This snippet shows you how to get an individual PDF configuration and do an active if it's currently active:

add_action( 'init', function() {
if ( class_exists( 'GPDFAPI' ) ) {

/* Get the individual PDF config */
$pdf = GPDFAPI::get_pdf( 2, '56c14c955d989' );

if( true === $pdf['active'] ) {
//Do something if PDF is active
} else {
//Do something else if PDF is inactive
}
}
} );

Source Code

This method is located in api.php.