'always' | 'when_changed'
* 'scope' = 'form' - saved only via Save Form into settings_json field (e.g. { "options": { "key":"value" } }) in the Table: wp_booking_form_structures
* 'scope' = 'ui' - UI-only (no DB save)
*
*
* @package Booking Calendar.
* @author wpdevelop, oplugins
* @web-site https://wpbookingcalendar.com/
* @email info@wpbookingcalendar.com
*
* @since 11.0.x
* @file ../booking/includes/page-form-builder/form-settings/options-defs.php
*
* @modified 2026-01-24 20:12
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Print Settings Options groups.
*/
function wpbc_bfb_ui__settings_options__print() {
// ======================================================================
// == Group: Basic
// ======================================================================
$panel_id_basic = 'wpbc_bfb_form_settings_panel_basic';
?>
'toggle',
'key' => 'booking_use_bfb_form',
'scope' => 'global',
'save_ui' => 'when_changed', // always | when_changed.
'default' => get_bk_option( 'booking_use_bfb_form', 'On' ),
'label' => __( 'Drag & Drop Form Builder', 'booking' ),
'help' => __( 'Enables the new drag & drop form builder. Disable this option to use the classic booking form. Reload the page, after saving.', 'booking' ),
'attr' => array(),
)
);
WPBC_BFB_Setting_Options::print_option(
array(
'type' => 'toggle',
'key' => 'booking_timeslot_picker',
'scope' => 'global',
'save_ui' => 'always', // always | when_changed.
'default' => get_bk_option( 'booking_timeslot_picker', 'On' ),
'label' => __( 'Time picker for time slots', 'booking' ),
'help' => __( 'Show time slots as a time picker instead of a select box.', 'booking' ),
'attr' => array(
'id' => 'wpbc_bfb__toggle_booking_timeslot_picker',
'class' => 'js-toggle-timeslot-picker',
),
)
);
WPBC_BFB_Setting_Options::print_option(
array(
'type' => 'toggle',
'key' => 'booking_is_use_autofill_4_logged_user',
'scope' => 'global',
'save_ui' => 'when_changed', // always | when_changed.
'default' => get_bk_option( 'booking_is_use_autofill_4_logged_user', 'Off' ),
'label' => __( 'Auto-fill fields', 'booking' ),
'help' => __( 'Prefill form fields with the current user’s details when the user is logged in.', 'booking' ) . ' ' .
__( 'Click Preview to see it in action.', 'booking' ),
'attr' => array(
'id' => 'wpbc_bfb__checkbox_autofill_4_logged_user',
),
)
);
?>
'radio',
'key' => 'booking_form_theme',
'scope' => 'form',
'default' => '', // Applied from JS: 'wpbc:bfb:form_settings:apply' -- In 'settings_json' table field it's: { "options":{"booking_form_theme":"wpbc_theme_dark_1", ... } }.
'label' => __( 'Color theme', 'booking' ),
'help' => __( 'Select a color theme for your booking form that matches the look of your website.', 'booking' ),
'attr' => array(
'id' => 'booking_form_theme',
),
'radio_layout' => 'inline', // inline | stack.
'options' => array(
'' => __( 'Light', 'booking' ),
'wpbc_theme_dark_1' => __( 'Dark', 'booking' ),
),
)
);
// Form width (LOCAL FORM SETTING) stored as ONE combined value like "100%".
WPBC_BFB_Setting_Options::print_option(
array(
'type' => 'length',
'key' => 'booking_form_layout_width',
'scope' => 'form',
'default' => '100%', // Applied from JS too; this is a fallback.
'label' => __( 'Form width', 'booking' ),
'help' => __( 'Set the width of the booking form container.', 'booking' ),
'attr' => array(
'id' => 'booking_form_layout_width',
),
'length' => array(
'default_unit' => '%',
'units' => array(
'%' => '%',
'px' => 'px',
'rem' => 'rem',
'em' => 'em',
),
'bounds_map' => array(
'%' => array( 'min' => 30, 'max' => 100, 'step' => 1 ),
'px' => array( 'min' => 300, 'max' => 2000, 'step' => 10 ),
'rem' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ),
'em' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ),
),
),
)
);
?>
'toggle',
'key' => 'booking_is_use_phone_validation',
'scope' => 'global',
'save_ui' => 'when_changed', // always | when_changed.
'default' => get_bk_option( 'booking_is_use_phone_validation', 'Off' ),
'label' => __( 'Smart phone validation', 'booking' ),
'help' => __( 'Validate phone number fields according to the user’s selected country format (e.g., +1 000 000 0000).', 'booking' ),
'attr' => array(
'id' => 'set_gen_booking_is_use_phone_validation',
),
)
);
if ( class_exists( 'wpdev_bk_biz_m' ) ) {
WPBC_BFB_Setting_Options::print_option(
array(
'type' => 'range',
'key' => 'booking_number_for_pre_checkin_date_hint',
'scope' => 'global',
'save_ui' => 'when_changed', // always | when_changed.
'default' => get_bk_option( 'booking_number_for_pre_checkin_date_hint', '14' ),
'label' => __( 'Pre-check-in display duration', 'booking' ),
'help' => __( 'Select the number of days used by the [pre_checkin_date_hint] shortcode (N days before the selected check-in date).', 'booking' ),
'attr' => array( 'id' => 'set_gen_booking_number_for_pre_checkin_date_hint' ),
'range' => array( 'min' => 1, 'max' => 91, 'step' => 1 ),
)
);
}
?>
'radio',
'key' => 'booking_type_of_day_selections',
'scope' => 'form',
'default' => '',
'label' => __( 'Days selection mode', 'booking' ),
'help' => __( 'Choose how visitors can select dates in this form’s calendar.', 'booking' ) . ' ' .
__( 'Default follows your global setting for the whole site.', 'booking' ) . ' ' .
__( 'Click Preview to see it in action.', 'booking' ),
'attr' => array(
'id' => 'booking_type_of_day_selections',
),
'radio_layout' => 'inline',
'options' => array(
'' => __( 'Default', 'booking' ) . ' (' . __( 'calendar settings', 'booking' ) . ')',
'single' => __( 'Single day', 'booking' ),
'multiple' => __( 'Multiple days', 'booking' ),
),
) );
?>
'toggle',
'key' => 'booking_bfb_preview_mode',
'scope' => 'ui',
'default' => 'On',
'label' => __( 'Preview mode', 'booking' ),
'help' => __( 'Enable live preview rendering while building the form.', 'booking' ),
'attr' => array(
'id' => 'wpbc_bfb__toggle_preview',
),
)
);
?>