GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-edit_link-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default edit link field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 /** @var \GV\GF_Form $gf_form */
15 $gf_form = isset( $gravityview->field->form_id ) ? \GV\GF_Form::by_id( $gravityview->field->form_id ) : $gravityview->view->form;
16 $form = $gf_form->form;
17 
18 if ( $gravityview->entry->is_multi() ) {
19  $entry = $gravityview->entry->from_field( $gravityview->field );
20  $entry = $entry->as_entry();
21 } else {
22  $entry = $gravityview->entry->as_entry();
23 }
24 
25 $field_settings = $gravityview->field->as_configuration();
26 
27 global $post;
28 
29 if ( ! class_exists( 'GravityView_Edit_Entry' ) ) {
30  return;
31 }
32 
33 // Only show the link to logged-in users.
34 if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $entry, $gravityview->view->ID ) ) {
35  return;
36 }
37 
38 $link_text = empty( $field_settings['edit_link'] ) ? __( 'Edit Entry', 'gk-gravityview' ) : $field_settings['edit_link'];
39 
40 $link_atts = array();
41 if ( ! empty( $field_settings['new_window'] ) ) {
42  $link_atts['target'] = '_blank';
43 }
44 
45 $output = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ), $gravityview );
46 
47 $href = GravityView_Edit_Entry::get_edit_link( $entry, $gravityview->view->ID, $post ? $post->ID : null );
48 
static get_edit_link( $entry, $view_id, $post_id=null, $field_values='')
The edit entry link creates a secure link with a nonce.
static check_user_cap_edit_entry( $entry, $view=0)
checks if user has permissions to edit a specific entry
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
static by_id( $form_id)
Construct a instance by ID.
static replace_variables( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=true, $nl2br=true, $format='html', $aux_data=array())
Alias for GravityView_Merge_Tags::replace_variables()
Definition: class-api.php:118
gravityview()
The main GravityView wrapper function.
$entry
Definition: notes.php:27