Hi, sascha,
You can use the Gravity Forms hook "gform_field_input" (http://www.gravityhelp.com/documentation/page/Gform_field_input). This hook allows you to completely write the <input> tag for one of the fields on your form. In this hook, you can call the wp_get_attachment_image function with your attachment id. That function returns the full <input> tag, so you can simply return that and your new field will show.
Below is an example I created to do this. Take a look and let me know if you have questions.
add_action("gform_field_input", "display_attachment", 10, 5);
function display_attachment($input, $field, $value, $lead_id, $form_id)
{
//because this will fire for every form/field, only do it when it is the specific form and field
if ($form_id == 23 && $field["id"] == 12)
{
$input = wp_get_attachment_image(114);
return $input;
}
}
Posted 12 years ago on Monday February 13, 2012 |
Permalink