GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-email.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-email.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
8 /**
9  * Add custom options for email fields
10  */
12 
13  var $name = 'email';
14 
15  var $is_searchable = true;
16 
17  var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
18 
19  var $_gf_field_class_name = 'GF_Field_Email';
20 
21  var $group = 'advanced';
22 
23  var $icon = 'dashicons-email';
24 
25  public function __construct() {
26  $this->label = esc_html__( 'Email', 'gk-gravityview' );
27  parent::__construct();
28  }
29 
30  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
31 
32  // It makes no sense to use this as the link.
33  unset( $field_options['show_as_link'] );
34 
35  if( 'edit' === $context ) {
36  return $field_options;
37  }
38 
39  $email_options = array(
40  'emailmailto' => array(
41  'type' => 'checkbox',
42  'value' => true,
43  'label' => __( 'Link the Email Address', 'gk-gravityview' ),
44  'desc' => __( 'Clicking the link will generate a new email.', 'gk-gravityview' ),
45  'group' => 'field',
46  ),
47  'emailsubject' => array(
48  'type' => 'text',
49  'label' => __( 'Email Subject', 'gk-gravityview' ),
50  'value' => '',
51  'desc' => __( 'Set the default email subject line.', 'gk-gravityview' ),
52  'merge_tags' => 'force',
53  'requires' => 'emailmailto',
54  'group' => 'field',
55  ),
56  'emailbody' => array(
57  'type' => 'textarea',
58  'label' => __( 'Email Body', 'gk-gravityview' ),
59  'value' => '',
60  'desc' => __( 'Set the default email content.', 'gk-gravityview' ),
61  'merge_tags' => 'force',
62  'class' => 'widefat code',
63  'requires' => 'emailmailto',
64  'group' => 'field',
65  ),
66  'emailencrypt' => array(
67  'type' => 'checkbox',
68  'value' => true,
69  'label' => __( 'Encrypt Email Address', 'gk-gravityview' ),
70  'desc' => __( 'Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gk-gravityview' ),
71  'group' => 'advanced',
72  'priority' => 100,
73  ),
74  );
75 
76  return $email_options + $field_options;
77  }
78 
79 }
80 
Modify field settings by extending this class.
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
Add custom options for email fields.
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