GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-duplicate_link-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default duplicate link field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.5
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_Duplicate_Entry' ) ) {
30  return;
31 }
32 
33 // Only show the link to logged-in users with the right caps.
35  return;
36 }
37 
38 $link_text = \GV\Utils::get( $field_settings, 'duplicate_link', esc_html__( 'Delete Entry', 'gk-gravityview' ) );
39 
40 $link_text = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ), $gravityview );
41 
42 $href = GravityView_Duplicate_Entry::get_duplicate_link( $entry, $gravityview->view->ID, $post ? $post->ID : null );
43 
44 $attributes = array(
46 );
47 
gravityview_get_link( $href='', $anchor_text='', $atts=array())
Generate an HTML anchor tag with a list of supported attributes.
static check_user_cap_duplicate_entry( $entry, $field=array(), $view_id=0)
checks if user has permissions to view the link or duplicate a specific entry
static get_duplicate_link( $entry, $view_id, $post_id=null)
Generate a nonce link with the base URL of the current View embed.
static get_confirm_dialog()
Get the onclick attribute for the confirm dialogs that warns users before they duplicate an entry...
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
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.
gravityview()
The main GravityView wrapper function.
$entry
Definition: notes.php:27