GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-entry-link.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-entry-link.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
8 /**
9  * Add custom options for entry_link fields
10  */
12 
13  var $name = 'entry_link';
14 
15  var $contexts = array( 'multiple' );
16 
17  /**
18  * @var bool
19  * @since 1.15.3
20  */
21  var $is_sortable = false;
22 
23  /**
24  * @var bool
25  * @since 1.15.3
26  */
27  var $is_searchable = false;
28 
29  var $group = 'gravityview';
30 
31  var $icon = 'dashicons-media-default';
32 
33  public function __construct() {
34  $this->label = esc_html__( 'Link to Single Entry', 'gk-gravityview' );
35  $this->description = esc_html__('A dedicated link to the single entry with customizable text.', 'gk-gravityview');
36  parent::__construct();
37  }
38 
39  /**
40  * Add as a default field, outside those set in the Gravity Form form
41  *
42  * @since 2.10 Moved here from GravityView_Admin_Views::get_entry_default_fields
43  *
44  * @param array $entry_default_fields Existing fields
45  * @param string|array $form form_ID or form object
46  * @param string $zone Either 'single', 'directory', 'edit', 'header', 'footer'
47  *
48  * @return array
49  */
50  public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
51 
52  if ( 'directory' !== $zone ) {
53  return $entry_default_fields;
54  }
55 
56  $entry_default_fields[ $this->name ] = array(
57  'label' => $this->label,
58  'type' => $this->name,
59  'desc' => $this->description,
60  'icon' => $this->icon,
61  );
62 
63  return $entry_default_fields;
64  }
65 
66  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
67 
68  // Always a link!
69  unset( $field_options['show_as_link'], $field_options['search_filter'] );
70 
71  if( 'edit' === $context ) {
72  return $field_options;
73  }
74 
75  $add_options = array();
76  $add_options['entry_link_text'] = array(
77  'type' => 'text',
78  'label' => __( 'Link Text:', 'gk-gravityview' ),
79  'desc' => NULL,
80  'value' => __('View Details', 'gk-gravityview'),
81  'merge_tags' => true,
82  );
83 
84  $this->add_field_support( 'new_window', $field_options );
85 
86  return $add_options + $field_options;
87  }
88 
89 }
90 
Modify field settings by extending this class.
__construct()
Add custom options for entry_link fields.
$is_searchable
$icon
add_field_support( $key, &$field_options)
$name
new GravityView_Field_Entry_Link
if(gravityview() ->plugin->is_GF_25()) $form
$group
$is_sortable
scale description p description
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
add_default_field( $entry_default_fields, $form=array(), $zone='')
Add as a default field, outside those set in the Gravity Form form.
if(empty( $created_by)) $form_id
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
Definition: time.php:22
$contexts