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