1 | <?php |
||
12 | class GravityView_Field_Product extends GravityView_Field { |
||
13 | |||
14 | var $name = 'product'; |
||
15 | |||
16 | var $is_searchable = true; |
||
17 | |||
18 | var $is_numeric = false; |
||
19 | |||
20 | var $search_operators = array( 'is', 'isnot', 'contains' ); |
||
21 | |||
22 | var $group = 'product'; |
||
23 | |||
24 | /** @see GF_Field_Product */ |
||
25 | var $_gf_field_class_name = 'GF_Field_Product'; |
||
26 | |||
27 | /** |
||
28 | * @since 1.20 |
||
29 | */ |
||
30 | public function __construct() { |
||
38 | |||
39 | /** |
||
40 | * If the edited entry has a product field and the fields are shown, remove entry purchase cache |
||
41 | * |
||
42 | * @since 1.20 |
||
43 | * |
||
44 | * @param array $form Gravity Forms array |
||
45 | * @param int $entry_id Gravity Forms entry ID |
||
46 | * @param GravityView_Edit_Entry_Render $Edit_Entry_Render |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | 1 | function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
|
65 | |||
66 | /** |
||
67 | * Maybe add Product fields to the Edit Entry blacklist |
||
68 | * |
||
69 | * @since 1.20 |
||
70 | * |
||
71 | * @param array $blacklist Array of field types not to be shown in the Edit Entry form |
||
72 | * @param array $entry Gravity Forms entry array |
||
73 | * |
||
74 | * @return array Blacklist with product field types added, if should not be shown |
||
75 | */ |
||
76 | 1 | public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) { |
|
84 | |||
85 | /** |
||
86 | * In Edit Entry, should Product fields be hidden? If entry has transaction data, they should be. Otherwise, no. |
||
87 | * |
||
88 | * @since 1.20 |
||
89 | * |
||
90 | * @param array $entry Current Gravity Forms entry being edited |
||
91 | * |
||
92 | * @return bool True: hide product fields; False: show product fields |
||
93 | */ |
||
94 | 1 | public function should_hide_product_fields( $entry = array() ) { |
|
109 | } |
||
110 | |||
112 |
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.