1 | <?php |
||
9 | class GravityView_Field_Total extends GravityView_Field { |
||
10 | |||
11 | var $name = 'total'; |
||
12 | |||
13 | var $is_searchable = true; |
||
14 | |||
15 | var $is_numeric = true; |
||
16 | |||
17 | var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'contains' ); |
||
18 | |||
19 | var $group = 'product'; |
||
20 | |||
21 | /** @see GF_Field_Total */ |
||
22 | var $_gf_field_class_name = 'GF_Field_Total'; |
||
23 | |||
24 | public function __construct() { |
||
33 | |||
34 | /** |
||
35 | * Prevent the Total fields from being displayed in the Edit Entry configuration screen -- for now |
||
36 | * |
||
37 | * Gravity Forms forms need to know all the pricing information available to calculate a Total. |
||
38 | * |
||
39 | * If you have an Edit Entry field with just two fields (Quantity and Total), the Total will not be able to calculate |
||
40 | * without the Product field, and possibly the Option, Shipping, and Coupon fields. |
||
41 | * |
||
42 | * The only options currently available are: show the whole form, or don't show the Total |
||
43 | * |
||
44 | * @since 1.20 |
||
45 | * |
||
46 | * @todo Support Total fields in Edit Entry configuration |
||
47 | * |
||
48 | * @param array $blacklist Array of field types not able to be added to Edit Entry |
||
49 | * @param string|null $context Context |
||
50 | * |
||
51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
||
52 | */ |
||
53 | public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
||
63 | |||
64 | /** |
||
65 | * If entry has totals fields, recalculate them |
||
66 | * |
||
67 | * @since 1.20 |
||
68 | * |
||
69 | * @param array $form Gravity Forms form array |
||
70 | * @param int $entry_id Gravity Forms Entry ID |
||
71 | * @param GravityView_Edit_Entry_Render $Edit_Entry_Render |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | 1 | function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
|
100 | } |
||
101 | |||
103 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.