PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.1.5
JetFormBuilder — Dynamic Blocks Form Builder v2.1.5
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 / get-from-field.php
jetformbuilder / includes / compatibility / jet-engine / generators Last commit date
je-query-object-handlers 3 years ago get-from-field.php 3 years ago get-from-je-query.php 3 years ago
get-from-field.php
75 lines
1 <?php
2
3 namespace Jet_Form_Builder\Compatibility\Jet_Engine\Generators;
4
5 use Jet_Form_Builder\Generators\Base;
6
7 class Get_From_Field extends Base {
8
9 /**
10 * Returns generator ID
11 *
12 * @return string
13 */
14 public function get_id() {
15 return 'get_from_field';
16 }
17
18 /**
19 * Returns generator name
20 *
21 * @return string
22 */
23 public function get_name() {
24 return __( 'Get values list from JetEngine field options', 'jet-form-builder' );
25 }
26
27 /**
28 * Returns generated options list
29 *
30 * @param $args
31 *
32 * @return array
33 */
34 public function generate( $args ) {
35 $field = $args['generator_field'] ?? '';
36 $all_fields = jet_engine()->meta_boxes->get_registered_fields();
37 $found_field = null;
38 $result = array();
39 $parse_field = explode( '|', $field );
40 $field = $parse_field[0];
41 $sub_field = isset( $parse_field[1] ) ? $parse_field[1] : false;
42
43 foreach ( $all_fields as $object => $fields ) {
44 foreach ( $fields as $field_data ) {
45 if ( ! empty( $field_data['name'] ) && $field === $field_data['name'] ) {
46 $found_field = $field_data;
47 }
48 }
49 }
50
51 if ( ! empty( $sub_field ) && ! empty( $found_field['repeater-fields'] ) ) {
52 foreach ( $found_field['repeater-fields'] as $repeater_field_data ) {
53 if ( ! empty( $repeater_field_data['name'] ) && $sub_field === $repeater_field_data['name'] ) {
54 $found_field = $repeater_field_data;
55 }
56 }
57 }
58
59 if ( empty( $found_field['options'] ) ) {
60 return $result;
61 }
62
63 foreach ( $found_field['options'] as $option ) {
64 $result[] = array(
65 'value' => $option['key'],
66 'label' => $option['value'],
67 );
68 }
69
70 return $result;
71
72 }
73
74 }
75