GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-select.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-select.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
9 
10  var $name = 'select';
11 
12  var $is_searchable = true;
13 
14  /**
15  * @see GFCommon::get_field_filter_settings
16  * @var array
17  */
18  var $search_operators = array( 'is', 'isnot', 'contains' );
19 
20  var $_gf_field_class_name = 'GF_Field_Select';
21 
22  var $group = 'standard';
23 
24  var $icon = 'dashicons-arrow-down';
25 
26  public function __construct() {
27  $this->label = esc_html__( 'Select', 'gk-gravityview' );
28  parent::__construct();
29  }
30 
31  /**
32  * Add `choice_display` setting to the field
33  *
34  * @param array $field_options
35  * @param string $template_id
36  * @param string $field_id
37  * @param string $context
38  * @param string $input_type
39  *
40  * @since 1.17
41  *
42  * @return array
43  */
44  public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
45 
46  // Set the $_field_id var
47  $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
48 
49  if( $this->is_choice_value_enabled() ) {
50  $field_options['choice_display'] = array(
51  'type' => 'radio',
52  'value' => 'value',
53  'label' => __( 'What should be displayed:', 'gk-gravityview' ),
54  'desc' => __( 'This input has a label and a value. What should be displayed?', 'gk-gravityview' ),
55  'choices' => array(
56  'value' => __( 'Value of the input', 'gk-gravityview' ),
57  'label' => __( 'Label of the input', 'gk-gravityview' ),
58  ),
59  'group' => 'display',
60  );
61  }
62 
63  return $field_options;
64  }
65 
66 }
67 
Modify field settings by extending this class.
is_choice_value_enabled()
Check whether the enableChoiceValue flag is set for a GF field.
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)
Add choice_display setting to the field.