GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-plugin-hooks-gravity-perks.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Fix Gravity Perks conflicts with GravityView
4  *
5  * @file class-gravityview-plugin-hooks-gravity-perks.php
6  * @package GravityView
7  * @license GPL2+
8  * @author GravityView <[email protected]>
9  * @link https://gravityview.co
10  * @copyright Copyright 2016, Katz Web Services, Inc.
11  *
12  * @since 1.17.5
13  */
14 
15 /**
16  * @inheritDoc
17  * @since 1.17.5
18  */
20 
21  /**
22  * @var string Check for the Gravity Perks class
23  */
24  protected $class_name = 'GravityPerks';
25 
26 
27  /**
28  * Filter the values shown in GravityView frontend
29  *
30  * @since 1.17
31  */
32  protected function add_hooks() {
33 
34  parent::add_hooks();
35 
36  add_filter( 'gravityview/edit_entry/form_fields', array( $this, 'edit_entry_fix_uid_fields' ) );
37 
38  }
39 
40 
41  /**
42  * Convert Unique ID fields to be Text fields in Edit Entry
43  *
44  * @since 1.17.4
45  *
46  * @param GF_Field[] $fields Array of fields to be shown on the Edit Entry screen
47  *
48  * @return GF_Field[] Array of fields, with any hidden fields replaced with text fields
49  */
50  public function edit_entry_fix_uid_fields( $fields ) {
51 
52  /** @type \GF_Field $field */
53  foreach( $fields as &$field ) {
54  if ( 'uid' === $field->type ) {
55 
56  // Replace GF_Field with GF_Field_Text, copying all the data from $field
57  $field = new GF_Field_Text( $field );
58 
59  // Everything is copied from $field, so we need to manually set the type
60  $field->type = 'text';
61  }
62  }
63 
64  return $fields;
65  }
66 
67 }
68 
edit_entry_fix_uid_fields( $fields)
Convert Unique ID fields to be Text fields in Edit Entry.
Abstract class that makes it easy for plugins and themes to register no-conflict scripts and styles...
add_hooks()
Filter the values shown in GravityView frontend.