Greetings all,
I'm searching for any clues on how to print a submitted form WITH the original styling intact. I've successfully hacked together parts of print-entry.php to get this working, but I've hit some snags.
Here's my code thus far:
add_filter('gform_field_value_field_9', 'field_9');
function field_9($value){
$display_empty_fields = true;
//use the function name to match the field id
$field_id = __FUNCTION__;
preg_match('@^(?:field_)?([^/]+)@i', $field_id, $matches);
$field = $matches[1];
//get value of field
$value = RGFormsModel::get_lead_field_value($lead, $field);
$display_value = GFCommon::get_lead_field_display($field, $value, $lead["currency"]);
$display_value = apply_filters("gform_entry_field_value", $display_value, $field, $lead, $form);
if($display_empty_fields || !empty($display_value) || $display_value === "0"){
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
$last_row = $is_last ? " lastrow" : "";
$display_value = empty($display_value) && $display_value !== "0" ? " " : $display_value;
$content = ''.$display_value.'';
$content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
}
//echo works, return doesn't
return $content;
}
It generates any value for a specified $field_id just fine, but it chokes on the return to dynamically populate the actual fields. It also will not return checkbox values, which I understand is a function of text values vs checked/not checked states.
Soooooo...how can it be done? I really want to stay close to the metal on this, but I'm willing to keep coding if needed. I just need a way for my client to hit "Print" in the admin and see a fully-filled form that looks like the original template. I need this method to work, or to find a new way to go about it. Any ideas?
Note: I'm working on one project right now, but there's at least one more developer's license to purchase for new clients if we can figure it out. :)
Thanks for your time.