PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.0.1
JetFormBuilder — Dynamic Blocks Form Builder v3.0.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 / includes / compatibility / jet-engine / generators / je-query-object-handlers / base-object-handler.php
jetformbuilder / includes / compatibility / jet-engine / generators / je-query-object-handlers Last commit date
base-object-handler.php 3 years ago user-object-handler.php 3 years ago
base-object-handler.php
68 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Compatibility\Jet_Engine\Generators\Je_Query_Object_Handlers;
5
6
7 class Base_Object_Handler {
8
9 protected $value_field;
10 protected $label_field;
11 protected $calc_field;
12 protected $additional;
13
14 public function is_supported( $object ): bool {
15 return true;
16 }
17
18 public function set_fields( array $args ) {
19 $this->value_field = $args[1] ?? 'ID';
20 $this->label_field = $args[2] ?? 'post_title';
21 $this->calc_field = $args[3] ?? false;
22 $this->additional = $args[4] ?? false;
23 }
24
25 final public function to_array( $object ): array {
26 // convert to array because in 8.2 dynamic properties will be deprecated
27 $converted = $this->get_converted( $object );
28
29 $value = $this->get_value( $converted, $object );
30 $label = $this->get_label( $converted, $object );
31 $calculated = $this->get_calc( $converted, $object );
32
33 $value = apply_filters( 'jet-forms-generate-from-query/value', $value, $object, $this->additional );
34 $label = apply_filters( 'jet-forms-generate-from-query/label', $label, $object, $this->additional );
35 $calculated = apply_filters( 'jet-forms-generate-from-query/calculated', $calculated, $object, $this->additional );
36
37 $item = array();
38
39 if ( $value ) {
40 $item['value'] = $value;
41 $item['label'] = $label;
42 }
43
44 if ( $this->calc_field ) {
45 $item['calculate'] = $calculated;
46 }
47
48 return $item;
49 }
50
51 protected function get_converted( $object ) {
52 // convert to array because in 8.2 dynamic properties will be deprecated
53 return get_object_vars( $object );
54 }
55
56 protected function get_value( $converted, $object ) {
57 return $converted[ $this->value_field ] ?? false;
58 }
59
60 protected function get_label( $converted, $object ) {
61 return $converted[ $this->label_field ] ?? $this->get_value( $converted, $object );
62 }
63
64 protected function get_calc( $converted, $object ) {
65 return $converted[ $this->calc_field ] ?? false;
66 }
67
68 }