Created
November 3, 2015 21:11
-
-
Save RickeyMessick/fc1849be8305d253c921 to your computer and use it in GitHub Desktop.
Gravity Forms get all fields function to use with gform_after_submission to display just filled out fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_all_fields($entry, $form) | |
{ | |
//only do this for a certain form (id 53 for example) | |
// if ($form["id"] == 17) | |
//{ | |
foreach($form["fields"] as &$field) | |
{ | |
//see if this is a multi-field, like name or address | |
if (is_array($field["inputs"])) | |
{ | |
//loop through inputs | |
foreach($field["inputs"] as &$input) | |
{ | |
$label = $input["label"]; | |
//get value from entry object; change the id to a string | |
$value = $entry[strval($input["id"])]; | |
if (!empty($value)) { | |
$output .= $label . ':' . $value . ' '; | |
} | |
//print_r($output); | |
} | |
} | |
else | |
{ | |
$label = $field["label"]; | |
//get value from entry object | |
$value = $entry[$field["id"]]; | |
if (!empty($value)) { | |
$output .= $label . ':' . $value . ' '; | |
} | |
//print_r($output); | |
} | |
} | |
//print_r($output); | |
return $output; | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about
Or: