GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-plugin-hooks-acf.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Add Advanced Custom Fields customizations
4  *
5  * @file class-gravityview-plugin-hooks-acf.php
6  * @package GravityView
7  * @license GPL2+
8  * @author Katz Web Services, Inc.
9  * @link http://gravityview.co
10  * @copyright Copyright 2015, Katz Web Services, Inc.
11  *
12  * @since 1.16.5
13  */
14 
15 /**
16  * @inheritDoc
17  * @since 1.16.5
18  */
20 
21  /**
22  * @inheritDoc
23  * @since 1.16.5
24  */
25  protected $function_name = 'acf';
26 
27  /**
28  * @since 1.16.5
29  */
30  protected function add_hooks() {
31  parent::add_hooks();
32 
33  $this->fix_posted_fields();
34  }
35 
36  /**
37  * ACF needs $_POST['fields'] to be an array. GV supports both serialized array and array, so we just process earlier.
38  *
39  * @since 1.16.5
40  *
41  * @return void
42  */
43  private function fix_posted_fields() {
44  if( is_admin() && isset( $_POST['action'] ) && isset( $_POST['post_type'] ) ) {
45  if( 'editpost' === $_POST['action'] && 'gravityview' === $_POST['post_type'] ) {
46  $_POST['fields'] = _gravityview_process_posted_fields();
47  }
48  }
49  }
50 }
51 
fix_posted_fields()
ACF needs $_POST[&#39;fields&#39;] to be an array.
_gravityview_process_posted_fields()
Maybe convert jQuery-serialized fields into array, otherwise return $_POST[&#39;fields&#39;] array...
Abstract class that makes it easy for plugins and themes to register no-conflict scripts and styles...