$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($entry['post_id']), $image_size); if (empty($image_url[0])) { do_action('gravityview_log_debug', 'Dynamic featured image for post #' . $entry['post_id'] . ' doesnt exist (size: ' . $image_size . ').'); } else { $url = $image_url[0]; } } ## ## Get the link URL ## // Link to the post created by the entry if (!empty($field_settings['link_to_post'])) { $href = get_permalink($entry['post_id']); } else { if (!empty($field_settings['show_as_link'])) { $href = gv_entry_link($entry); } else { $href = $url; // Only show the lightbox if linking to the file itself if ($gravityview_view->getAtts('lightbox')) { $link_atts .= "target='_blank' class='thickbox'"; } } } // Set the attributes for the link $link_atts .= " href='{$href}'"; // Add the title as the link title, if exists. This will appear as caption in the lightbox. $link_atts .= ' title="' . esc_attr($title) . '"'; ## ## Get the image ##
/** * The edit entry link creates a secure link with a nonce * * It also mimics the URL structure Gravity Forms expects to have so that * it formats the display of the edit form like it does in the backend, like * "You can edit this post from the post page" fields, for example. * * @param $entry array Gravity Forms entry object * @param $view_id int GravityView view id * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } * @return string */ static function get_edit_link($entry, $view_id, $post_id = null, $field_values = '') { $nonce_key = self::get_nonce_key($view_id, $entry['form_id'], $entry['id']); $base = gv_entry_link($entry, $post_id); $url = add_query_arg(array('page' => 'gf_entries', 'view' => 'entry', 'edit' => wp_create_nonce($nonce_key)), $base); /** * Allow passing params to dynamically populate entry with values * @since 1.9.2 */ if (!empty($field_values)) { if (is_array($field_values)) { // If already an array, no parse_str() needed $params = $field_values; } else { parse_str($field_values, $params); } $url = add_query_arg($params, $url); } return $url; }