Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Perks // GP Nested Forms // Display Table Format for All Fields
<?php
/**
* Gravity Perks // GP Nested Forms // Display Table Format for All Fields
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_action( 'init', function() {
if( ! is_callable( 'gp_nested_forms' ) ) {
return;
}
add_filter( 'gform_merge_tag_filter', function( $value, $merge_tag, $modifiers, $field, $raw_value ) {
if( $field->type != 'form' || $value === false ) {
return $value;
}
$template = new GP_Template( gp_nested_forms() );
$nested_form = GFAPI::get_form( rgar( $field, 'gpnfForm' ) );
$args = array(
'template' => 'nested-entries-detail',
'field' => $field,
'nested_form' => GFAPI::get_form( rgar( $field, 'gpnfForm' ) ),
'modifiers' => $modifiers,
'nested_fields' => gp_nested_forms()->get_fields_by_ids( rgar( $field, 'gpnfFields' ), $nested_form ),
'entries' => gp_nested_forms()->get_entries( $raw_value ),
'actions' => array(),
'nested_field_ids' => rgar( $field, 'gpnfFields' ),
'labels' => array( 'view_entry' => '' )
);
$value = $template->parse_template( array(
sprintf( '%s-%s-%s.php', $args['template'], $nested_form['id'], $field->id ),
sprintf( '%s-%s.php', $args['template'], $nested_form['id'] ),
sprintf( '%s.php', $args['template'] ),
), true, false, $args );
return $value;
}, 12, 5 );
} );
@frankdage

This comment has been minimized.

Copy link

frankdage commented Feb 6, 2019

Hello, how do I implement this please. I mean I want to see all form views with child entries just like gravityforms displays in their entries on the frontend with probably a shortcode. How do I go about this please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.