GravityView  1.19.4
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  var $_gf_field_class_name = 'GF_Field_Select';
15 
16  var $group = 'standard';
17 
18  public function __construct() {
19  $this->label = esc_html__( 'Select', 'gravityview' );
20  parent::__construct();
21  }
22 
23  /**
24  * Add `choice_display` setting to the field
25  *
26  * @param array $field_options
27  * @param string $template_id
28  * @param string $field_id
29  * @param string $context
30  * @param string $input_type
31  *
32  * @since 1.17
33  *
34  * @return array
35  */
36  function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
37 
38  // Set the $_field_id var
39  $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
40 
41  if( $this->is_choice_value_enabled() ) {
42  $field_options['choice_display'] = array(
43  'type' => 'radio',
44  'value' => 'value',
45  'label' => __( 'What should be displayed:', 'gravityview' ),
46  'desc' => __( 'This input has a label and a value. What should be displayed?', 'gravityview' ),
47  'choices' => array(
48  'value' => __( 'Value of the input', 'gravityview' ),
49  'label' => __( 'Label of the input', 'gravityview' ),
50  ),
51  );
52  }
53 
54  return $field_options;
55  }
56 
57 }
58 
Modify field settings by extending this class.
is_choice_value_enabled()
Check whether the enableChoiceValue flag is set for a GF field.
$field_id
Definition: time.php:17
field_options($field_options, $template_id, $field_id, $context, $input_type)
Add choice_display setting to the field.