PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / trunk
JetFormBuilder — Dynamic Blocks Form Builder vtrunk
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 / macros / auto-update-field-value.php
jetformbuilder / compatibility / jet-engine / macros Last commit date
auto-update-appointment-provider.php 2 months ago auto-update-appointment-service.php 2 months ago auto-update-field-value.php 2 months ago base-field-context-macro.php 2 months ago
auto-update-field-value.php
86 lines
1 <?php
2 /**
3 * JetEngine Macro for accessing form field values during auto-update.
4 *
5 * This macro allows JetEngine Query Builder to access values from form fields
6 * when options are being dynamically regenerated via auto-update feature.
7 *
8 * Usage in JetEngine Query:
9 * Use dynamic tag "JFB Auto-Update - Field Value" with field_name parameter
10 * in query conditions, meta queries, or tax queries.
11 *
12 * @package JFB_Compatibility\Jet_Engine\Macros
13 */
14
15 namespace JFB_Compatibility\Jet_Engine\Macros;
16
17 // If this file is called directly, abort.
18 if ( ! defined( 'WPINC' ) ) {
19 die;
20 }
21
22 /**
23 * Auto_Update_Field_Value class.
24 *
25 * JetEngine macro that retrieves form field values from the auto-update context.
26 * Values are available in scoped $GLOBALS['jfb_generator_context'] and
27 * in legacy $_REQUEST / $GLOBALS keys with 'jfb_update_related_' prefix.
28 */
29 class Auto_Update_Field_Value extends Base_Field_Context_Macro {
30
31 /**
32 * Returns macro tag for JetEngine.
33 *
34 * @return string
35 */
36 public function macros_tag() {
37 return 'jfb_auto_update_field_value';
38 }
39
40 /**
41 * Returns macro name displayed in JetEngine UI.
42 *
43 * @return string
44 */
45 public function macros_name() {
46 return 'JFB Auto-Update - Field Value';
47 }
48
49 /**
50 * Returns macro arguments configuration.
51 *
52 * @return array
53 */
54 public function macros_args() {
55 return array(
56 'field_name' => array(
57 'label' => __( 'Field Name', 'jet-form-builder' ),
58 'type' => 'text',
59 'default' => '',
60 ),
61 );
62 }
63
64 /**
65 * Macro callback - retrieves field value from request context.
66 *
67 * Preferred source (scoped): $GLOBALS['jfb_generator_context'][field_name].
68 * Legacy fallback sources:
69 * - $_REQUEST['jfb_update_related_' . field_name]
70 * - $GLOBALS['jfb_update_related_' . field_name] (set by Get_From_Je_Query::generate_with_context).
71 *
72 * @param array $args Macro arguments with 'field_name'.
73 *
74 * @return string|int|array Field value or empty string if not found.
75 */
76 public function macros_callback( $args = array() ) {
77 $field_name = ! empty( $args['field_name'] ) ? $args['field_name'] : null;
78
79 if ( ! $field_name ) {
80 return '';
81 }
82
83 return $this->get_context_value( $field_name );
84 }
85 }
86