Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
Gravity PDF v4 will receive bug fixes and security updates until October 4, 2019, however it's recommended you upgrade to v5 as soon as practical.
Jump To Section

Description #description

Use this filter to dynamically change a field’s value in Core and Universal templates before it gets wrapped in the final HTML markup. In the majority of cases this filter will be more useful than gfpdf_field_html_value. Be aware, section fields, page fields and the product table are not run through this filter.

Version #version

This filter was introduced in Gravity PDF 4.2.

Parameters #parameters

$value | string
The field’s content to be included in the PDF
$field | array
The current field being processed
$entry | array
The Gravity Forms entry array
$form | array
The Gravity Forms array
$pdf_field | object
The current field helper class. See /src/helper/fields

Usage #usage

The following code will prefix all values with a bullet point:

add_filter( 'gfpdf_pdf_field_content', function( $value, $field, $entry, $form ) {
    return '• ' . $value;
}, 10, 4 );

You can also target specific field types:

add_filter( 'gfpdf_pdf_field_content_text', function( $value, $field, $entry, $form ) {
    return '• ' . $value;
}, 10, 4 );

Or an individual field, targeted by ID:

add_filter( 'gfpdf_pdf_field_content', function( $value, $field, $entry, $form ) {
    if( $field->id === 20 ) {
        return '• ' . $value;
    }

    return $value;
}, 10, 4 );

Display each sub-field in an address field on a new line:

add_filter( 'gfpdf_pdf_field_content', function( $value, $field, $entry, $form, $pdf_field ) {
        if( $field->type === 'address' ) {
        $content = $pdf_field->value();

            return implode( '<br>', array_filter( $content ) );
        }

    return $value;
}, 10, 5 );

Source Code #source-code

This filter is located in the Helper_Abstract_Fields.php files in the /src/helper/abstract/ directory.

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 (¥)