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 field labels in the Core and Universal PDF templates.

Version #version

This filter was introduced in Gravity PDF 4.2.

Parameters #parameters

$label | string
The current label to be displayed in the PDF
$field | array
The current field being processed
$entry | array
The Gravity Forms entry array

Usage #usage

The following code will display a field’s admin label if it exists, otherwise fall back to the standard label:

add_filter( 'gfpdf_field_label', function( $label, $field, $entry ) {
    return ( strlen( $field->adminLabel ) > 0 ) ? $field->adminLabel : $label;
}, 10, 3 );

You can also target specific field types:

add_filter( 'gfpdf_field_label', function( $label, $field, $entry ) {
    if( $field->type === 'text' ) {
        return 'Text Label';
    }

    return $label;
}, 10, 3 );

Or an individual field:

add_filter( 'gfpdf_field_label', function( $label, $field, $entry ) {
    if( $field->id === 20 ) {
        return 'Field #20 Label';
    }

    return $label;
}, 10, 3 );

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