GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-source-url.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-source-url.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
8 /**
9  * Add custom options for source_url fields
10  */
12 
13  var $name = 'source_url';
14 
15  var $is_searchable = true;
16 
17  var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
18 
19  var $group = 'meta';
20 
21  var $icon = 'dashicons-admin-links';
22 
23  public function __construct() {
24  $this->label = esc_html__( 'Source URL', 'gk-gravityview' );
25  $this->description = esc_html__( 'The URL of the page where the form was submitted.', 'gk-gravityview' );
26  parent::__construct();
27  }
28 
29  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
30 
31  // Don't link to entry; doesn't make sense.
32  unset( $field_options['show_as_link'] );
33 
34  if( 'edit' === $context ) {
35  return $field_options;
36  }
37 
38  $add_options = array();
39  $add_options['link_to_source'] = array(
40  'type' => 'checkbox',
41  'label' => __( 'Link to URL:', 'gk-gravityview' ),
42  'desc' => __('Display as a link to the Source URL', 'gk-gravityview'),
43  'value' => false,
44  'merge_tags' => false,
45  );
46  $add_options['source_link_text'] = array(
47  'type' => 'text',
48  'label' => __( 'Link Text:', 'gk-gravityview' ),
49  'desc' => __('Customize the link text. If empty, the link text will be the URL.', 'gk-gravityview'),
50  'value' => NULL,
51  'merge_tags' => true,
52  'requires' => 'link_to_source',
53  );
54 
55  return $add_options + $field_options;
56  }
57 
58 }
59 
Modify field settings by extending this class.
Add custom options for source_url fields.
scale description p description
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
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)