PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / compatibility / jet-engine / generators / je-query-object-handlers / base-object-handler.php
jetformbuilder / compatibility / jet-engine / generators / je-query-object-handlers Last commit date
base-object-handler.php 2 years ago user-object-handler.php 2 years ago
base-object-handler.php
76 lines
1 <?php
2
3
4 namespace JFB_Compatibility\Jet_Engine\Generators\Je_Query_Object_Handlers;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 class Base_Object_Handler {
12
13 protected $value_field;
14 protected $label_field;
15 protected $calc_field;
16 protected $additional;
17
18 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
19 public function is_supported( $current ): bool {
20 return true;
21 }
22
23 public function set_fields( array $args ) {
24 $this->value_field = $args[1] ?? 'ID';
25 $this->label_field = $args[2] ?? 'post_title';
26 $this->calc_field = $args[3] ?? false;
27 $this->additional = $args[4] ?? false;
28 }
29
30 final public function to_array( $current ): array {
31 // convert to array because in 8.2 dynamic properties will be deprecated
32 $converted = $this->get_converted( $current );
33
34 $value = $this->get_value( $converted, $current );
35 $label = $this->get_label( $converted, $current );
36 $calculated = $this->get_calc( $converted, $current );
37
38 $value = apply_filters( 'jet-forms-generate-from-query/value', $value, $current, $this->additional );
39 $label = apply_filters( 'jet-forms-generate-from-query/label', $label, $current, $this->additional );
40 $calculated = apply_filters( 'jet-forms-generate-from-query/calculated', $calculated, $current, $this->additional );
41
42 $item = array();
43
44 if ( $value ) {
45 $item['value'] = $value;
46 $item['label'] = $label;
47 }
48
49 if ( $this->calc_field ) {
50 $item['calculate'] = $calculated;
51 }
52
53 return $item;
54 }
55
56 protected function get_converted( $current ) {
57 // convert to array because in 8.2 dynamic properties will be deprecated
58 return get_object_vars( $current );
59 }
60
61 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
62 protected function get_value( $converted, $current ) {
63 return $converted[ $this->value_field ] ?? false;
64 }
65
66 protected function get_label( $converted, $current ) {
67 return $converted[ $this->label_field ] ?? $this->get_value( $converted, $current );
68 }
69
70 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
71 protected function get_calc( $converted, $current ) {
72 return $converted[ $this->calc_field ] ?? false;
73 }
74
75 }
76