GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-hidden.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-hidden.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
9 
10  var $name = 'hidden';
11 
12  var $is_searchable = true;
13 
14  var $_gf_field_class_name = 'GF_Field_Hidden';
15 
16  var $group = 'standard';
17 
18  public function __construct() {
19  $this->label = esc_html__( 'Hidden', 'gravityview' );
20 
21  $this->edit_entry_add_hooks();
22 
23  parent::__construct();
24  }
25 
26  /**
27  * Add Edit Entry hooks
28  *
29  * @since 1.17
30  *
31  * @return void
32  */
33  private function edit_entry_add_hooks() {
34  add_filter( 'gravityview/edit_entry/form_fields', array( $this, 'edit_entry_fix_hidden_fields' ) );
35  }
36 
37  /**
38  * Convert Hidden fields to be Text fields in Edit Entry
39  *
40  * @since 1.9.2
41  * @since 1.17 Moved to GravityView_Field_Hidden class
42  *
43  * @param GF_Field[] $fields Array of fields to be shown on the Edit Entry screen
44  *
45  * @return GF_Field[] Array of fields, with any hidden fields replaced with text fields
46  */
47  function edit_entry_fix_hidden_fields( $fields ) {
48 
49  /** @var GF_Field $field */
50  foreach( $fields as &$field ) {
51  if ( 'hidden' === $field->type ) {
52 
53  // Replace GF_Field_Hidden with GF_Field_Text, copying all the data from $field
54  $field = new GF_Field_Text( $field );
55 
56  // Everything is copied from $field, so we need to manually set the type
57  $field->type = 'text';
58  }
59  }
60 
61  return $fields;
62  }
63 
64 }
65 
Modify field settings by extending this class.
edit_entry_add_hooks()
Add Edit Entry hooks.
$field
Definition: gquiz_grade.php:11