Skip to content

Commit bc2d6e9

Browse files
authored
gppa-lmt-gravity-pdf-url.php: Added a new snippet to populate the URL of a Gravity PDF.
1 parent c827b26 commit bc2d6e9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Populate Anything // Populate Gravity PDF URL via Live Merge Tag
4+
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
5+
*
6+
* Use this snippet to convert an entry ID value from one field to a Gravity PDF URL for population in another field via
7+
* Live Merge Tags.
8+
*
9+
* Instructions:
10+
*
11+
* 1. Add the :gravitypdf modifier to any Live Merge Tag for a field that contains an entry ID value.
12+
* 2. Replace "643772a552da1" (in the code below) with the ID of the PDF you'd like to generate.
13+
*/
14+
add_filter( 'gppa_live_merge_tag_value', function( $value, $merge_tag, $form, $field_id, $entry_values ) {
15+
if ( strpos( $merge_tag, ':gravitypdf' ) !== false ) {
16+
$pdf = GPDFAPI::get_mvc_class( 'Model_PDF' );
17+
// Update "643772a552da1" with the ID of the PDF you'd like to generate.
18+
return $pdf->get_pdf_url( '643772a552da1', $value, false, false );
19+
}
20+
return $value;
21+
}, 10, 5 );

0 commit comments

Comments
 (0)