Skip to content

Commit 4ee1e6c

Browse files
authored
gpnf-export-child-field-header.php: Updated to add support for handling input-specific column headers.
1 parent a03b307 commit 4ee1e6c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

gp-nested-forms/gpnf-export-child-field-header.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
* Gravity Perks // Nested Forms // Only show child field labels when Nested Form field has no label
44
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
55
*/
6-
add_filter( 'gpnf_export_child_field_header', function( $header, $form, $field, $child_field ) {
6+
add_filter( 'gpnf_export_child_field_header', function( $header, $form, $field, $child_field, $input ) {
77

88
$parent_label = $field->get_field_label( false, null );
9+
if ( ! empty( $parent_label ) ) {
10+
return $header;
11+
}
12+
13+
$child_field_label = $child_field->get_field_label( false, null );
914

10-
if ( empty( $parent_label ) ) {
11-
$header = $child_field->get_field_label( false, null );
15+
if ( rgar( $input, 'label' ) ) {
16+
$header = sprintf( '%s (%s)', $child_field_label, $input['label'] );
1217
} else {
13-
$header = sprintf( '%s / %s', $parent_label, $child_field->get_field_label( false, null ) );
18+
$header = $child_field_label;
1419
}
1520

1621
return $header;
17-
}, 10, 4 );
22+
}, 10, 5 );

0 commit comments

Comments
 (0)