Skip to content

Commit d3572f7

Browse files
authored
gpnf-comma-delimited-email-list.php: Created a new snippet to get a comma-delimited list of emails from child entries.
1 parent 2ae352e commit d3572f7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Nested Forms // Convert Simple List to Comma-delimited List of Emails
4+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
5+
*
6+
* Requires the All Fields Template plugin: https://gravitywiz.com/gravity-forms-all-fields-template/
7+
*
8+
* Example usage: {My Nested Form Field:1:filter[2]:listemails}
9+
*
10+
* - where "1" is the ID of yoru Nested Form field.
11+
* - "2" is the ID of the Email field on your child form.
12+
* - and the "listemails" modifier activates this snippet.
13+
*/
14+
add_filter( 'gp_template_output_nested-entries-simple-list', function( $markup, $located_template, $load, $args ) {
15+
if ( strpos( $args['modifiers'], 'listemails' ) ) {
16+
$markup = array();
17+
foreach ( $args['items'] as $item ) {
18+
$markup[] = strip_tags( $item['value'] );
19+
}
20+
$markup = implode( ',', $markup );
21+
}
22+
return $markup;
23+
}, 10, 4 );

0 commit comments

Comments
 (0)