Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions gp-nested-forms/gpnf-gflow-auto-attach-child-entries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Gravity Perks // Nested Forms // Auto-attach Child Entries to Parent when Editing via Gravity Flow.
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* By default, when adding a new child entry to a Nested Form field while editing a parent entry via Gravity Flow, the
* child entry is saved to the session and will not be attached to the parent entry unless you click "Submit" on the
* workflow.
*
* Use this snippet to automatically attach the child entry to the parent as soon as the child form is submitted.
*/
add_filter( 'gpnf_set_parent_entry_id', function( $parent_entry_id ) {
if ( ! $parent_entry_id && is_callable( 'gravity_flow' ) && gravity_flow()->is_workflow_detail_page() ) {
$parent_entry_id = rgget( 'lid' ) ? rgget( 'lid' ) : $parent_entry_id;
}
return $parent_entry_id;
} );
Loading