Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/a80d7ac9d3bb62aa0febe86af7b93f8f to your computer and use it in GitHub Desktop.
Save spivurno/a80d7ac9d3bb62aa0febe86af7b93f8f to your computer and use it in GitHub Desktop.
Gravity Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View
<?php
/**
* Gravity Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gravityview/edit_entry/field_value', function( $field_value, $field ) {
// Update "123" to your form ID and "4" to your field ID.
if ( $field->formId == 123 && $field->id == 4 ) {
if ( isset( $GLOBALS['gppa-field-values'] ) ) {
$hydrated_field = gp_populate_anything()->hydrate_field( $field, GFAPI::get_form( $field->formId ), array(), null, false );
$field_value = $hydrated_field['field_value'];
}
}
return $field_value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment