';
$html .= '
' . $stage_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$html .= '' . esc_html__( 'Loading appointment…', 'booking' ) . '
';
$html .= '';
return (string) apply_filters( 'wpbc_booking_appointment_shortcode_html', $html, $config, $result );
}
add_shortcode( 'booking_appointment', 'wpbc_booking_appointment_shortcode' );
/**
* Enqueue the Appointment selector controller on public Booking Calendar pages.
*
* @param string $where_to_load Booking Calendar asset context.
*
* @return void
*/
function wpbc_booking_appointment_enqueue_js( $where_to_load ) {
if ( ! in_array( $where_to_load, array( 'client', 'both' ), true ) ) {
return;
}
$base_url = trailingslashit( plugins_url( '', __FILE__ ) );
wp_enqueue_script( 'wpbc-booking-appointment', $base_url . '_out/booking-appointment.js', array( 'jquery', 'wpbc_capacity' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
wp_localize_script(
'wpbc-booking-appointment',
'wpbc_booking_appointment_config',
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'action' => 'WPBC_AJX_BOOKING_APPOINTMENT_RESOLVE',
'validate_action' => 'WPBC_AJX_BOOKING_APPOINTMENT_VALIDATE_TIME',
'nonce' => wp_create_nonce( 'wpbc_booking_appointment_ajax' ),
'error' => __( 'The Appointment form could not be loaded. Please try again.', 'booking' ),
'validation_error'=> __( 'This Appointment time could not be verified. Please try again.', 'booking' ),
'initialization_error' => __( 'The Appointment form could not be initialized. Please start over and try again.', 'booking' ),
'duplicate_provider' => __( 'This Provider already has an open Appointment form on this page. Complete or restart that Appointment before opening another form for the same Provider.', 'booking' ),
'service_found' => __( 'Service found.', 'booking' ),
'services_found' => __( 'Services found.', 'booking' ),
'provider_found' => __( 'Provider found.', 'booking' ),
'providers_found' => __( 'Providers found.', 'booking' ),
)
);
}
add_action( 'wpbc_enqueue_js_files', 'wpbc_booking_appointment_enqueue_js', 72 );
/**
* Enqueue Appointment selector styling on public Booking Calendar pages.
*
* @param string $where_to_load Booking Calendar asset context.
*
* @return void
*/
function wpbc_booking_appointment_enqueue_css( $where_to_load ) {
$is_add_appointment_admin_page = 'admin' === $where_to_load
&& function_exists( 'wpbc_add_appointment_page_is_active' )
&& wpbc_add_appointment_page_is_active();
if ( ! in_array( $where_to_load, array( 'client', 'both' ), true ) && ! $is_add_appointment_admin_page ) {
return;
}
wp_enqueue_style( 'wpbc-booking-appointment', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/booking-appointment.css', array( 'wpbc-all-client' ), WP_BK_VERSION_NUM );
$theme_css = wpbc_booking_appointment_build_theme_css();
if ( '' !== $theme_css && class_exists( 'WPBC_FE_Assets' ) ) {
WPBC_FE_Assets::add_inline_css_to_wp_style( 'wpbc-booking-appointment', $theme_css, 'booking-appointment-theme' );
}
}
add_action( 'wpbc_enqueue_css_files', 'wpbc_booking_appointment_enqueue_css', 72 );