GravityView  1.19.4
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', 'gravityview' );
24 
25  add_filter( 'gravityview_blacklist_field_types', array( $this, 'blacklist_field_types' ), 10, 2 );
26 
27  parent::__construct();
28  }
29 
30  /**
31  * Don't show the Calculation field in field picker
32  * @param array $field_types Array of field types
33  * @param string $context
34  *
35  * @return array Field types with calculation added, if not Edit Entry context
36  */
37  public function blacklist_field_types( $field_types = array(), $context = '' ) {
38 
39  // Allow Calculation field in Edit Entry
40  if( 'edit' !== $context ) {
41  $field_types[] = $this->name;
42  }
43 
44  return $field_types;
45  }
46 }
47 
Modify field settings by extending this class.
blacklist_field_types($field_types=array(), $context= '')
Don&#39;t show the Calculation field in field picker.
__construct()
GravityView_Field_Calculation constructor.