GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-field-calculation.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-gravityview-field-calculation.php
4  * @package GravityView
5  * @subpackage includes\fields
6  */
7 
9 
10  var $name = 'calculation';
11 
12  var $is_searchable = false;
13 
14  var $group = 'pricing';
15 
16  var $_gf_field_class_name = 'GF_Field_Calculation';
17 
18  /**
19  * GravityView_Field_Calculation constructor.
20  */
21  public function __construct() {
22 
23  $this->label = esc_html__( 'Calculation', 'gk-gravityview' );
24 
25  add_filter( 'gravityview_blocklist_field_types', array( $this, 'blocklist_field_types' ), 10, 2 );
26 
27  parent::__construct();
28  }
29 
30  /**
31  * @depecated 2.14
32  */
33  public function blacklist_field_types( $field_types = array(), $context = '' ) {
34  _deprecated_function( __METHOD__, '2.14', 'GravityView_Field_Calculation::blocklist_field_types' );
35  return $this->blocklist_field_types( $field_types, $context );
36  }
37 
38 
39  /**
40  * Don't show the Calculation field in field picker
41  *
42  * @since 2.14
43  *
44  * @param array $field_types Array of field types
45  * @param string $context
46  *
47  * @return array Field types with calculation added, if not Edit Entry context
48  */
49  public function blocklist_field_types( $field_types = array(), $context = '' ) {
50 
51  // Allow Calculation field in Edit Entry
52  if( 'edit' !== $context ) {
53  $field_types[] = $this->name;
54  }
55 
56  return $field_types;
57  }
58 }
59 
Modify field settings by extending this class.
blacklist_field_types( $field_types=array(), $context='')
2.14
__construct()
GravityView_Field_Calculation constructor.
blocklist_field_types( $field_types=array(), $context='')
Don&#39;t show the Calculation field in field picker.