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