Skip to content

Commit 2b6afec

Browse files
committed
gw-advanced-merge-tags.php: Added support for {all_fields} modifier to show data for all entries.
1 parent b2580db commit 2b6afec

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

gravity-forms/gw-advanced-merge-tags.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,25 @@ public function handle_field_modifiers( $value, $input_id, $modifier, $field, $r
506506
return rgar( $value_array, $index );
507507
}
508508
break;
509+
case 'all_fields':
510+
// {all_fields} merge tag support needs to get the entry IDs from the raw value.
511+
$entries = json_decode( $raw_value, true );
512+
513+
// loop through each entry ID and get the {all_fields} output.
514+
$output = '';
515+
foreach ( $entries as $entry_id ) {
516+
$entry = GFAPI::get_entry( $entry_id );
517+
$form = GFAPI::get_form( $entry['form_id'] );
518+
519+
// Get the {all_fields} output for each entry.
520+
$all_fields_output = GFCommon::replace_variables( '{all_fields}', $form, $entry, false, false, false );
521+
522+
$output .= $all_fields_output;
523+
}
524+
525+
// if no entries were found, return the original value.
526+
$value = $output ? $output : $value;
527+
break;
509528
}
510529
}
511530

0 commit comments

Comments
 (0)