Integrate with Gravity Forms to create a Pod item from a form submission.
Special thanks to Rocketgenius for their sponsorship support and to Naomi C. Bush for her help in the initial add-on UI work.
This add-on provides the ability to sync entries from a Form Submission and Entry Edit screen. To bulk sync all entries even prior to setting up a Pods Gravity Form Feed, you can run a WP-CLI command.
Example 1: Sync all entries for Form 123 first active Pod feed
wp pods-gf sync --form=123
Example 2: Sync all entries for Form 123 using a specific feed (even if it is inactive)
wp pods-gf sync --form=123 --feed=2
You can map a GF List field to a Relationship field related to another Pod. Using the below examples you can customize how the automatic mapping works. By default, the list columns will map to the pod fields with the same labels.
Example 1: Customize what columns map to which Related Pod fields for Form ID 1, Field ID 2
Customizing a list field row can be done by using the pods_gf_field_columns_mapping
filter, which has Form ID and Field ID variations (pods_gf_field_columns_mapping_{form_id}
and pods_gf_field_columns_mapping_{form_id}_{field_id}
).
add_filter( 'pods_gf_field_columns_mapping_1_2', 'my_columns_mapping', 10, 4 ); /** * Filter list columns mapping for related pod fields. * * @param array $columns List field columns. * @param array $form GF form. * @param GF_Field $gf_field GF field data. * @param Pods $pod Pods object. * * @return array */ function my_columns_mapping( $columns, $form, $gf_field, $related_obj ) { $columns[0] = 'first_field'; $columns[1] = 'second_field'; $columns[2] = 'third_field'; return $columns; }
Example 2: Customize a List row for Form ID 1, Field ID 2
Customizing a list field row can be done by using the pods_gf_field_column_row
filter, which has Form ID and Field ID variations (pods_gf_field_column_row_{form_id}
and pods_gf_field_column_row_{form_id}_{field_id}
).
add_filter( 'pods_gf_field_column_row_1_2', 'my_column_row_override', 10, 6 ); /** * Filter list field row for relationship field saving purposes. * * @param array $row List field row. * @param array $columns List field columns. * @param array $form GF form. * @param GF_Field $gf_field GF field data. * @param array $options Pods GF options. * @param Pods|false $related_obj Related Pod object. * * @return array */ function my_column_row_override( $row, $columns, $form, $gf_field, $options, $related_obj ) { // Update certain row fields based on the value of specific column. if ( ! empty( $row['user_relationship_field'] ) ) { $user = get_userdata( (int) $row['user'] ); // Set the post_title to match the User display name. if ( $user && ! is_wp_error( $user ) ) { $row['post_title'] = $user->display_name; } } return $row; }
In the Pods Admin, create your Pods and Pod Fields: Pods Admin -> Add New
In the Pods Admin, create your Pods and Pod Fields: Pod Edit Screen
Create your Gravity Form that will be used to create a Pod item
Form Settings->Pods menu
Pods feed page
Map form fields to Pod fields
Example form
New Pod item created from form submission
Form entries page showing Pod ID
?pods_gf_debug=1
to a form submit URL to debug the form submission mapping to Pods which outputs debug information and stops before the save runs). (@sc0ttkclark)pods_gf_dynamic_select_show_empty_option
lets you disable showing the “empty option” in dynamic fields being prepopulated. (@sc0ttkclark)pods_gf_addon_options_{$form_id}
that lets you filter the options built for a feed for the Pods_GF
object. (@sc0ttkclark)pods-gf-ui-view-only
class added to the view-only mode. (@sc0ttkclark)select_text
option used. (@sc0ttkclark)Pods_GF_UI
. (@sc0ttkclark)ALSO: Pods Gravity Forms 2.0 is still in development and it brings complete compatibility with the latest Gravity Forms releases. We could use your support to help it get over the finish line this year. Please consider donating to the Pods project to help us get there more quickly.
?pods_gf_debug_gf_to_pods=1
to the URL of the form action before submitting to take advantage of the admin-only debug mode. This will output the values as they would be sent to Pods, the entry information used to reference it, and the feed options used at the time. It will stop the form from completely saving to Pods so you can tweak and debug your form feeds however much you’d like to perfect them. (@sc0ttkclark)gform_pre_render
.Pods_GF_UI
does not return false on UI callbacks to prevent access errors.wp pods-gf sync --form=123
or you can specify which feed (even if it is not active) with wp pods-gf sync --form=123 --feed=2
pods_gf_field_columns_mapping
and pods_gf_field_column_row
{form_id}
and any other merge tag{pods.id}
and {pods.permalink}
are available for usage and in the merge tag selection dropdowns