GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-other-entries.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-other-entries.php
4  * @package GravityView
5  * @subpackage includes\fields
6  * @since 1.7.2
7  */
8 
9 /**
10  * A field that displays other entries by the entry_creator for the same View in a list format
11  *
12  * @since 1.7.2
13  */
15 
16  var $name = 'other_entries';
17 
18  var $is_searchable = false;
19 
20  var $contexts = array( 'multiple', 'single' );
21 
22  var $group = 'gravityview';
23 
24  public function __construct() {
25  $this->label = esc_html__( 'Other Entries', 'gravityview' );
26  $this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview');
27  parent::__construct();
28  }
29 
30  /**
31  * @inheritDoc
32  * @since 1.7.2
33  */
34  function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
35 
36  if( 'edit' === $context ) {
37  return $field_options;
38  }
39 
40  // No "Link to single entry"; all the items will be links to entries!
41  unset( $field_options['show_as_link'] );
42 
43  $new_options = array();
44 
45  $new_options['link_format'] = array(
46  'type' => 'text',
47  'label' => __( 'Entry link text (required)', 'gravityview' ),
48  'value' => __('Entry #{entry_id}', 'gravityview'),
49  'merge_tags' => 'force',
50  );
51 
52  $new_options['after_link'] = array(
53  'type' => 'textarea',
54  'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ),
55  'desc' => __('This content will be displayed below each entry link.', 'gravityview'),
56  'value' => '',
57  'merge_tags' => 'force',
58  'class' => 'widefat code',
59  );
60 
61  $new_options['page_size'] = array(
62  'type' => 'number',
63  'label' => __( 'Entries to Display', 'gravityview' ),
64  'desc' => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ),
65  'value' => '10',
66  'merge_tags' => false,
67  );
68 
69  $new_options['no_entries_hide'] = array(
70  'type' => 'checkbox',
71  'label' => __( 'Hide if no entries', 'gravityview' ),
72  'desc' => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ),
73  'value' => false,
74  );
75 
76  $new_options['no_entries_text'] = array(
77  'type' => 'text',
78  'label' => __( 'No Entries Text', 'gravityview' ),
79  'desc' => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ),
80  'value' => __( 'This user has no other entries.', 'gravityview' ),
81  );
82 
83  return $new_options + $field_options;
84  }
85 
86 }
87 
Modify field settings by extending this class.
field_options($field_options, $template_id, $field_id, $context, $input_type)
scale description p description
A field that displays other entries by the entry_creator for the same View in a list format...
$field_id
Definition: time.php:17