Version: 5
🔥 Gravity PDF v5 end of life was 2023-04-28 and this version is no longer supported. This legacy documentation is kept for reference only.
gfpdf_pdf_field_content
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
This filter was introduced in Gravity PDF 4.2.
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
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 '