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-appointment-service.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-appointment-service.php
77 lines
1 <?php
2 /**
3 * JetAppointment service macro for JetFormBuilder auto-update.
4 *
5 * @package JFB_Compatibility\Jet_Engine\Macros
6 */
7
8 namespace JFB_Compatibility\Jet_Engine\Macros;
9
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 class Auto_Update_Appointment_Service extends Base_Field_Context_Macro {
15
16 public function macros_tag() {
17 return 'jfb_auto_update_appointment_service';
18 }
19
20 public function macros_name() {
21 return 'JFB Auto-Update - JetAppointment Service';
22 }
23
24 public function macros_args() {
25 return array(
26 'field_name' => array(
27 'label' => __( 'Field Name', 'jet-form-builder' ),
28 'type' => 'text',
29 'default' => '',
30 ),
31 );
32 }
33
34 public function macros_callback( $args = array() ) {
35 $field_name = ! empty( $args['field_name'] ) ? $args['field_name'] : null;
36
37 if ( ! $field_name || ! function_exists( 'jet_apb' ) || ! function_exists( 'jet_engine' ) ) {
38 return '';
39 }
40
41 $post_id = $this->get_context_value( $field_name );
42
43 if ( ! $post_id ) {
44 return '';
45 }
46
47 $post = get_post( $post_id );
48
49 if ( ! $post ) {
50 return '';
51 }
52
53 $provider_id = $post->ID;
54 $services_cpt = jet_apb()->settings->get( 'services_cpt' );
55 $providers_cpt = jet_apb()->settings->get( 'providers_cpt' );
56
57 if ( ! $provider_id || ! $services_cpt || ! $providers_cpt ) {
58 return '';
59 }
60
61 $services = jet_engine()->relations->get_related_posts(
62 array(
63 'post_type_1' => $services_cpt,
64 'post_type_2' => $providers_cpt,
65 'post_id' => $provider_id,
66 'from' => $services_cpt,
67 )
68 );
69
70 if ( ! is_array( $services ) ) {
71 $services = array( $services );
72 }
73
74 return implode( ',', array_filter( $services ) );
75 }
76 }
77