Keep up to date with Gravity PDF

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

Jump To Section

Description #description

Gravity PDF does standard sanitisation of form fields but you might like to include your own special processing for any form PDF fields you add.

You can also use the gfpdf_form_settings_sanitize_$type filter, where $type refers to the field type – checkbox, select, ect.

Parameters #parameters

$value | mixed
The new value of the current field being processed
$key | string
The ID of the field currently being processed
$input | array
An array containing all the current fields that should be updated
$field | mixed
The settings for the current field being processed

Usage #usage

This snippet shows you how to correctly sanitise your custom Gravity PDF field:

add_action( 'gfpdf_settings_sanitize', function( $value, $key, $input, $field ) {

    /* Check if it's our custom field and return a blank array if the variable type isn't currently an array */
    if( 'prefix_custom_field' === $key ) {
        if( ! is_array( $value ) ) {
            return array();
        }
    }

    return $value;

}, 10, 4 );

You can also target your field directly using the field ID:

add_action( 'gfpdf_settings_sanitize_prefix_custom_field', function( $value, $key, $input, $field ) {   
    if( ! is_array( $value ) ) {
        return array();
    }   

    return $value;
}, 10, 4 );

Source Code #source-code

This filter is located in the Model_Form_Settings::settings_sanitize() method of /src/model/Model_Form_Settings.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 (¥)