PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
← All changes | integrations/wp-booking-calendar/includes/functions.php +48 -0 5.7.6 → 6.0.3 View file →
@@ -1,0 +1,48 @@
1 +<?php
2 +
3 +/**
4 + * Functions
5 + *
6 + * @package AutomatorWP\BookingCalendar\Functions
7 + * @since 1.0.0
8 + */
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +
13 +/**
14 + * Options callback for select2 fields assigned to bookings
15 + *
16 + * @since 1.0.0
17 + *
18 + * @param stdClass $field
19 + *
20 + * @return array
21 + */
22 +function automatorwp_wp_booking_calendar_options_cb_booking( $field ) {
23 +
24 + // Setup vars
25 + $value = $field->escaped_value;
26 + $none_value = 'any';
27 + $none_label = __( 'any booking', 'automatorwp' );
28 + $options = automatorwp_options_cb_none_option( $field, $none_value, $none_label );
29 +
30 + if( ! empty( $value ) ) {
31 + if( ! is_array( $value ) ) {
32 + $value = array( $value );
33 + }
34 +
35 + foreach( $value as $booking_id ) {
36 +
37 + // Skip option none
38 + if( $booking_id === $none_value ) {
39 + continue;
40 + }
41 +
42 + $options[$booking_id] = $booking_id;
43 + }
44 + }
45 +
46 + return $options;
47 +
48 +}