← All changes
|
includes/page-form-builder/form-settings/options-defs.php
+844
-300
11.2.1
→
11.9
View file →
| @@ -1,300 +1,844 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * BFB Settings Options UI. | |
| 4 | - * | |
| 5 | - * Settings Conception Rules must stay simple: | |
| 6 | - * | |
| 7 | - * 'scope' = 'global' - row Save UI depends on 'save_ui' => 'always' | 'when_changed' | |
| 8 | - * 'scope' = 'form' - saved only via Save Form into settings_json field (e.g. { "options": { "key":"value" } }) in the Table: wp_booking_form_structures | |
| 9 | - * 'scope' = 'ui' - UI-only (no DB save) | |
| 10 | - * | |
| 11 | - * | |
| 12 | - * @package Booking Calendar. | |
| 13 | - * @author wpdevelop, oplugins | |
| 14 | - * @web-site https://wpbookingcalendar.com/ | |
| 15 | - * @email [email protected] | |
| 16 | - * | |
| 17 | - * @since 11.0.x | |
| 18 | - * @file ../booking/includes/page-form-builder/form-settings/options-defs.php | |
| 19 | - * | |
| 20 | - * @modified 2026-01-24 20:12 | |
| 21 | - */ | |
| 22 | - | |
| 23 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 24 | - exit; | |
| 25 | -} | |
| 26 | - | |
| 27 | - | |
| 28 | - | |
| 29 | -/** | |
| 30 | - * Print Settings Options groups. | |
| 31 | - */ | |
| 32 | -function wpbc_bfb_ui__settings_options__print() { | |
| 33 | - | |
| 34 | - // ====================================================================== | |
| 35 | - // == Group: Basic | |
| 36 | - // ====================================================================== | |
| 37 | - | |
| 38 | - $panel_id_basic = 'wpbc_bfb_form_settings_panel_basic'; | |
| 39 | - ?> | |
| 40 | - <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="settings-basic"> | |
| 41 | - <button type="button" class="group__header" role="button" aria-expanded="true" aria-controls="<?php echo esc_attr( $panel_id_basic ); ?>"> | |
| 42 | - <h3><?php esc_html_e( 'Basic', 'booking' ); ?></h3> | |
| 43 | - <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 44 | - </button> | |
| 45 | - | |
| 46 | - <div class="group__fields" id="<?php echo esc_attr( $panel_id_basic ); ?>" aria-hidden="false"> | |
| 47 | - <?php | |
| 48 | - | |
| 49 | - WPBC_BFB_Setting_Options::print_option( | |
| 50 | - array( | |
| 51 | - 'type' => 'toggle', | |
| 52 | - 'key' => 'booking_use_bfb_form', | |
| 53 | - 'scope' => 'global', | |
| 54 | - 'save_ui' => 'when_changed', // always | when_changed. | |
| 55 | - 'default' => get_bk_option( 'booking_use_bfb_form', 'On' ), | |
| 56 | - 'label' => __( 'Drag & Drop Form Builder', 'booking' ), | |
| 57 | - 'help' => __( 'Enables the new drag & drop form builder. Disable this option to use the classic booking form. Reload the page, after saving.', 'booking' ), | |
| 58 | - 'attr' => array(), | |
| 59 | - ) | |
| 60 | - ); | |
| 61 | - | |
| 62 | - WPBC_BFB_Setting_Options::print_option( | |
| 63 | - array( | |
| 64 | - 'type' => 'toggle', | |
| 65 | - 'key' => 'booking_timeslot_picker', | |
| 66 | - 'scope' => 'global', | |
| 67 | - 'save_ui' => 'always', // always | when_changed. | |
| 68 | - 'default' => get_bk_option( 'booking_timeslot_picker', 'On' ), | |
| 69 | - 'label' => __( 'Time picker for time slots', 'booking' ), | |
| 70 | - 'help' => __( 'Show time slots as a time picker instead of a select box.', 'booking' ), | |
| 71 | - 'attr' => array( | |
| 72 | - 'id' => 'wpbc_bfb__toggle_booking_timeslot_picker', | |
| 73 | - 'class' => 'js-toggle-timeslot-picker', | |
| 74 | - ), | |
| 75 | - ) | |
| 76 | - ); | |
| 77 | - | |
| 78 | - WPBC_BFB_Setting_Options::print_option( | |
| 79 | - array( | |
| 80 | - 'type' => 'toggle', | |
| 81 | - 'key' => 'booking_is_use_autofill_4_logged_user', | |
| 82 | - 'scope' => 'global', | |
| 83 | - 'save_ui' => 'when_changed', // always | when_changed. | |
| 84 | - 'default' => get_bk_option( 'booking_is_use_autofill_4_logged_user', 'Off' ), | |
| 85 | - 'label' => __( 'Auto-fill fields', 'booking' ), | |
| 86 | - 'help' => __( 'Prefill form fields with the current user’s details when the user is logged in.', 'booking' ) . ' ' . | |
| 87 | - __( 'Click Preview to see it in action.', 'booking' ), | |
| 88 | - 'attr' => array( | |
| 89 | - 'id' => 'wpbc_bfb__checkbox_autofill_4_logged_user', | |
| 90 | - ), | |
| 91 | - ) | |
| 92 | - ); | |
| 93 | - | |
| 94 | - ?> | |
| 95 | - </div> | |
| 96 | - </section> | |
| 97 | - <?php | |
| 98 | - | |
| 99 | - // ====================================================================== | |
| 100 | - // == Group: Appearance | |
| 101 | - // ====================================================================== | |
| 102 | - | |
| 103 | - $panel_id_appearance = 'wpbc_bfb_form_settings_panel_appearance'; | |
| 104 | - ?> | |
| 105 | - <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-appearance"> | |
| 106 | - <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_appearance ); ?>"> | |
| 107 | - <h3><?php esc_html_e( 'Appearance', 'booking' ); ?></h3> | |
| 108 | - <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 109 | - </button> | |
| 110 | - | |
| 111 | - <div class="group__fields" id="<?php echo esc_attr( $panel_id_appearance ); ?>" aria-hidden="true"> | |
| 112 | - <?php | |
| 113 | - | |
| 114 | - // Color theme (LOCAL FORM SETTING). | |
| 115 | - WPBC_BFB_Setting_Options::print_option( | |
| 116 | - array( | |
| 117 | - 'type' => 'radio', | |
| 118 | - 'key' => 'booking_form_theme', | |
| 119 | - 'scope' => 'form', | |
| 120 | - 'default' => '', // Applied from JS: 'wpbc:bfb:form_settings:apply' -- In 'settings_json' table field it's: { "options":{"booking_form_theme":"wpbc_theme_dark_1", ... } }. | |
| 121 | - 'label' => __( 'Color theme', 'booking' ), | |
| 122 | - 'help' => __( 'Select a color theme for your booking form that matches the look of your website.', 'booking' ), | |
| 123 | - 'attr' => array( | |
| 124 | - 'id' => 'booking_form_theme', | |
| 125 | - ), | |
| 126 | - 'radio_layout' => 'inline', // inline | stack. | |
| 127 | - 'options' => array( | |
| 128 | - '' => __( 'Light', 'booking' ), | |
| 129 | - 'wpbc_theme_dark_1' => __( 'Dark', 'booking' ), | |
| 130 | - ), | |
| 131 | - ) | |
| 132 | - ); | |
| 133 | - | |
| 134 | - // Form width (LOCAL FORM SETTING) stored as ONE combined value like "100%". | |
| 135 | - WPBC_BFB_Setting_Options::print_option( | |
| 136 | - array( | |
| 137 | - 'type' => 'length', | |
| 138 | - 'key' => 'booking_form_layout_width', | |
| 139 | - 'scope' => 'form', | |
| 140 | - 'default' => '100%', // Applied from JS too; this is a fallback. | |
| 141 | - 'label' => __( 'Form width', 'booking' ), | |
| 142 | - 'help' => __( 'Set the width of the booking form container.', 'booking' ), | |
| 143 | - 'attr' => array( | |
| 144 | - 'id' => 'booking_form_layout_width', | |
| 145 | - ), | |
| 146 | - 'length' => array( | |
| 147 | - 'default_unit' => '%', | |
| 148 | - 'units' => array( | |
| 149 | - '%' => '%', | |
| 150 | - 'px' => 'px', | |
| 151 | - 'rem' => 'rem', | |
| 152 | - 'em' => 'em', | |
| 153 | - ), | |
| 154 | - 'bounds_map' => array( | |
| 155 | - '%' => array( 'min' => 30, 'max' => 100, 'step' => 1 ), | |
| 156 | - 'px' => array( 'min' => 300, 'max' => 2000, 'step' => 10 ), | |
| 157 | - 'rem' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ), | |
| 158 | - 'em' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ), | |
| 159 | - ), | |
| 160 | - ), | |
| 161 | - ) | |
| 162 | - ); | |
| 163 | - | |
| 164 | - ?> | |
| 165 | - </div> | |
| 166 | - </section> | |
| 167 | - <?php | |
| 168 | - | |
| 169 | - // ====================================================================== | |
| 170 | - // == Group: Advanced | |
| 171 | - // ====================================================================== | |
| 172 | - | |
| 173 | - $panel_id_advanced = 'wpbc_bfb_form_settings_panel_advanced'; | |
| 174 | - ?> | |
| 175 | - <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-advanced"> | |
| 176 | - <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_advanced ); ?>"> | |
| 177 | - <h3><?php esc_html_e( 'Advanced', 'booking' ); ?></h3> | |
| 178 | - <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 179 | - </button> | |
| 180 | - | |
| 181 | - <div class="group__fields" id="<?php echo esc_attr( $panel_id_advanced ); ?>" aria-hidden="true"> | |
| 182 | - <?php | |
| 183 | - | |
| 184 | - WPBC_BFB_Setting_Options::print_option( | |
| 185 | - array( | |
| 186 | - 'type' => 'toggle', | |
| 187 | - 'key' => 'booking_is_use_phone_validation', | |
| 188 | - 'scope' => 'global', | |
| 189 | - 'save_ui' => 'when_changed', // always | when_changed. | |
| 190 | - 'default' => get_bk_option( 'booking_is_use_phone_validation', 'Off' ), | |
| 191 | - 'label' => __( 'Smart phone validation', 'booking' ), | |
| 192 | - 'help' => __( 'Validate phone number fields according to the user’s selected country format (e.g., +1 000 000 0000).', 'booking' ), | |
| 193 | - 'attr' => array( | |
| 194 | - 'id' => 'set_gen_booking_is_use_phone_validation', | |
| 195 | - ), | |
| 196 | - ) | |
| 197 | - ); | |
| 198 | - | |
| 199 | - if ( class_exists( 'wpdev_bk_biz_m' ) ) { | |
| 200 | - WPBC_BFB_Setting_Options::print_option( | |
| 201 | - array( | |
| 202 | - 'type' => 'range', | |
| 203 | - 'key' => 'booking_number_for_pre_checkin_date_hint', | |
| 204 | - 'scope' => 'global', | |
| 205 | - 'save_ui' => 'when_changed', // always | when_changed. | |
| 206 | - 'default' => get_bk_option( 'booking_number_for_pre_checkin_date_hint', '14' ), | |
| 207 | - 'label' => __( 'Pre-check-in display duration', 'booking' ), | |
| 208 | - 'help' => __( 'Select the number of days used by the [pre_checkin_date_hint] shortcode (N days before the selected check-in date).', 'booking' ), | |
| 209 | - 'attr' => array( 'id' => 'set_gen_booking_number_for_pre_checkin_date_hint' ), | |
| 210 | - 'range' => array( 'min' => 1, 'max' => 91, 'step' => 1 ), | |
| 211 | - ) | |
| 212 | - ); | |
| 213 | - } | |
| 214 | - | |
| 215 | - ?> | |
| 216 | - </div> | |
| 217 | - </section> | |
| 218 | - <?php | |
| 219 | - | |
| 220 | - // ====================================================================== | |
| 221 | - // == Group: Calendar | |
| 222 | - // ====================================================================== | |
| 223 | - | |
| 224 | - $panel_id_calendar = 'wpbc_bfb_form_settings_panel_calendar'; | |
| 225 | - ?> | |
| 226 | - <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-calendar"> | |
| 227 | - <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_calendar ); ?>"> | |
| 228 | - <h3><?php esc_html_e( 'Custom Days Selection', 'booking' ); ?></h3> | |
| 229 | - <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 230 | - </button> | |
| 231 | - | |
| 232 | - <div class="group__fields" id="<?php | |
| 233 | - echo esc_attr( $panel_id_calendar ); ?>" aria-hidden="true"> | |
| 234 | - <?php | |
| 235 | - | |
| 236 | - // Days selection in calendar (LOCAL FORM SETTING). | |
| 237 | - WPBC_BFB_Setting_Options::print_option( array( | |
| 238 | - 'type' => 'radio', | |
| 239 | - 'key' => 'booking_type_of_day_selections', | |
| 240 | - 'scope' => 'form', | |
| 241 | - 'default' => '', | |
| 242 | - 'label' => __( 'Days selection mode', 'booking' ), | |
| 243 | - 'help' => __( 'Choose how visitors can select dates in this form’s calendar.', 'booking' ) . ' ' . | |
| 244 | - __( 'Default follows your global setting for the whole site.', 'booking' ) . ' ' . | |
| 245 | - __( 'Click Preview to see it in action.', 'booking' ), | |
| 246 | - 'attr' => array( | |
| 247 | - 'id' => 'booking_type_of_day_selections', | |
| 248 | - ), | |
| 249 | - 'radio_layout' => 'inline', | |
| 250 | - 'options' => array( | |
| 251 | - '' => __( 'Default', 'booking' ) . ' (' . __( 'calendar settings', 'booking' ) . ')', | |
| 252 | - 'single' => __( 'Single day', 'booking' ), | |
| 253 | - 'multiple' => __( 'Multiple days', 'booking' ), | |
| 254 | - ), | |
| 255 | - ) ); | |
| 256 | - | |
| 257 | - ?> | |
| 258 | - </div> | |
| 259 | - </section> | |
| 260 | - <?php | |
| 261 | - | |
| 262 | - | |
| 263 | - if(0){ | |
| 264 | - // ====================================================================== | |
| 265 | - // == Group: Debug | |
| 266 | - // ====================================================================== | |
| 267 | - | |
| 268 | - $panel_id_debug = 'wpbc_bfb_form_settings_panel_debug'; | |
| 269 | - ?> | |
| 270 | - <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-debug"> | |
| 271 | - <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_debug ); ?>"> | |
| 272 | - <h3><?php esc_html_e( 'Debug', 'booking' ); ?></h3> | |
| 273 | - <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 274 | - </button> | |
| 275 | - | |
| 276 | - <div class="group__fields" id="<?php echo esc_attr( $panel_id_debug ); ?>" aria-hidden="true"> | |
| 277 | - <?php | |
| 278 | - | |
| 279 | - // UI-only: no save_ui; state comes from JS/UI or defaults. | |
| 280 | - WPBC_BFB_Setting_Options::print_option( | |
| 281 | - array( | |
| 282 | - 'type' => 'toggle', | |
| 283 | - 'key' => 'booking_bfb_preview_mode', | |
| 284 | - 'scope' => 'ui', | |
| 285 | - 'default' => 'On', | |
| 286 | - 'label' => __( 'Preview mode', 'booking' ), | |
| 287 | - 'help' => __( 'Enable live preview rendering while building the form.', 'booking' ), | |
| 288 | - 'attr' => array( | |
| 289 | - 'id' => 'wpbc_bfb__toggle_preview', | |
| 290 | - ), | |
| 291 | - ) | |
| 292 | - ); | |
| 293 | - | |
| 294 | - ?> | |
| 295 | - </div> | |
| 296 | - </section> | |
| 297 | - <?php | |
| 298 | - } | |
| 299 | - | |
| 300 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * BFB Settings Options UI. | |
| 4 | + * | |
| 5 | + * Settings Conception Rules must stay simple: | |
| 6 | + * | |
| 7 | + * 'scope' = 'global' - row Save UI depends on 'save_ui' => 'always' | 'when_changed' | |
| 8 | + * 'scope' = 'form' - saved only via Save Form into settings_json field (e.g. { "options": { "key":"value" } }) in the Table: wp_booking_form_structures | |
| 9 | + * 'scope' = 'ui' - UI-only (no DB save) | |
| 10 | + * | |
| 11 | + * | |
| 12 | + * @package Booking Calendar. | |
| 13 | + * @author wpdevelop, oplugins | |
| 14 | + * @web-site https://wpbookingcalendar.com/ | |
| 15 | + * @email [email protected] | |
| 16 | + * | |
| 17 | + * @since 11.0.x | |
| 18 | + * @file ../booking/includes/page-form-builder/form-settings/options-defs.php | |
| 19 | + * | |
| 20 | + * @modified 2026-01-24 20:12 | |
| 21 | + */ | |
| 22 | + | |
| 23 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 24 | + exit; | |
| 25 | +} | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * Print Settings Options groups. | |
| 31 | + */ | |
| 32 | +function wpbc_bfb_ui__settings_options__print() { | |
| 33 | + | |
| 34 | + $wpbc_bfb_current_form_style = function_exists( 'wpbc_bfb_settings__get_current_form_style' ) ? wpbc_bfb_settings__get_current_form_style() : 'light_bordered'; | |
| 35 | + $wpbc_bfb_custom_style_values = function_exists( 'wpbc_bfb_settings__get_custom_form_style_options' ) ? wpbc_bfb_settings__get_custom_form_style_options() : array(); | |
| 36 | + $wpbc_bfb_accent_values = function_exists( 'wpbc_bfb_settings__get_form_accent_options' ) ? wpbc_bfb_settings__get_form_accent_options() : array( | |
| 37 | + 'booking_form_accent_enabled' => 'Off', | |
| 38 | + 'booking_form_accent_color' => WPBC_DEFAULT_FORM_ACCENT_COLOR, | |
| 39 | + ); | |
| 40 | + | |
| 41 | + // ====================================================================== | |
| 42 | + // == Group: Basic | |
| 43 | + // ====================================================================== | |
| 44 | + | |
| 45 | + $panel_id_basic = 'wpbc_bfb_form_settings_panel_basic'; | |
| 46 | + ?> | |
| 47 | + <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="settings-basic"> | |
| 48 | + <button type="button" class="group__header" role="button" aria-expanded="true" aria-controls="<?php echo esc_attr( $panel_id_basic ); ?>"> | |
| 49 | + <h3><?php esc_html_e( 'Basic', 'booking' ); ?></h3> | |
| 50 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 51 | + </button> | |
| 52 | + | |
| 53 | + <div class="group__fields" id="<?php echo esc_attr( $panel_id_basic ); ?>" aria-hidden="false"> | |
| 54 | + <?php | |
| 55 | + | |
| 56 | + WPBC_BFB_Setting_Options::print_option( | |
| 57 | + array( | |
| 58 | + 'type' => 'toggle', | |
| 59 | + 'key' => 'booking_timeslot_picker', | |
| 60 | + 'scope' => 'global', | |
| 61 | + 'save_ui' => 'always', // always | when_changed. | |
| 62 | + 'default' => get_bk_option( 'booking_timeslot_picker', 'On' ), | |
| 63 | + 'label' => __( 'Time picker for time slots', 'booking' ), | |
| 64 | + 'help' => __( 'Show time slots as a time picker instead of a select box.', 'booking' ), | |
| 65 | + 'attr' => array( | |
| 66 | + 'id' => 'wpbc_bfb__toggle_booking_timeslot_picker', | |
| 67 | + 'class' => 'js-toggle-timeslot-picker', | |
| 68 | + ), | |
| 69 | + ) | |
| 70 | + ); | |
| 71 | + | |
| 72 | + WPBC_BFB_Setting_Options::print_option( | |
| 73 | + array( | |
| 74 | + 'type' => 'toggle', | |
| 75 | + 'key' => 'booking_is_use_autofill_4_logged_user', | |
| 76 | + 'scope' => 'global', | |
| 77 | + 'save_ui' => 'when_changed', // always | when_changed. | |
| 78 | + 'default' => get_bk_option( 'booking_is_use_autofill_4_logged_user', 'Off' ), | |
| 79 | + 'label' => __( 'Auto-fill fields', 'booking' ), | |
| 80 | + 'help' => __( 'Prefill form fields with the current user’s details when the user is logged in.', 'booking' ) . ' ' . | |
| 81 | + __( 'Click Preview to see it in action.', 'booking' ), | |
| 82 | + 'attr' => array( | |
| 83 | + 'id' => 'wpbc_bfb__checkbox_autofill_4_logged_user', | |
| 84 | + ), | |
| 85 | + ) | |
| 86 | + ); | |
| 87 | + | |
| 88 | + ?> | |
| 89 | + </div> | |
| 90 | + </section> | |
| 91 | + <?php | |
| 92 | + | |
| 93 | + // ====================================================================== | |
| 94 | + // == Group: Appearance | |
| 95 | + // ====================================================================== | |
| 96 | + | |
| 97 | + $panel_id_appearance = 'wpbc_bfb_form_settings_panel_appearance'; | |
| 98 | + ?> | |
| 99 | + <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-appearance"> | |
| 100 | + <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_appearance ); ?>"> | |
| 101 | + <h3><?php esc_html_e( 'Appearance', 'booking' ); ?></h3> | |
| 102 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 103 | + </button> | |
| 104 | + | |
| 105 | + <div class="group__fields" id="<?php echo esc_attr( $panel_id_appearance ); ?>" aria-hidden="true"> | |
| 106 | + <?php | |
| 107 | + | |
| 108 | + // Form width (LOCAL FORM SETTING) stored as ONE combined value like "100%". | |
| 109 | + WPBC_BFB_Setting_Options::print_option( | |
| 110 | + array( | |
| 111 | + 'type' => 'length', | |
| 112 | + 'key' => 'booking_form_layout_width', | |
| 113 | + 'scope' => 'form', | |
| 114 | + 'default' => '100%', // Applied from JS too; this is a fallback. | |
| 115 | + 'label' => __( 'Form width', 'booking' ), | |
| 116 | + 'help' => __( 'Set the width of the booking form container.', 'booking' ), | |
| 117 | + 'attr' => array( | |
| 118 | + 'id' => 'booking_form_layout_width', | |
| 119 | + ), | |
| 120 | + 'length' => array( | |
| 121 | + 'default_unit' => '%', | |
| 122 | + 'units' => array( | |
| 123 | + '%' => '%', | |
| 124 | + 'px' => 'px', | |
| 125 | + 'rem' => 'rem', | |
| 126 | + 'em' => 'em', | |
| 127 | + ), | |
| 128 | + 'bounds_map' => array( | |
| 129 | + '%' => array( 'min' => 30, 'max' => 100, 'step' => 1 ), | |
| 130 | + 'px' => array( 'min' => 300, 'max' => 2000, 'step' => 10 ), | |
| 131 | + 'rem' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ), | |
| 132 | + 'em' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ), | |
| 133 | + ), | |
| 134 | + ), | |
| 135 | + ) | |
| 136 | + ); | |
| 137 | + | |
| 138 | + | |
| 139 | + WPBC_BFB_Setting_Options::print_option( | |
| 140 | + array( | |
| 141 | + 'type' => 'toggle', | |
| 142 | + 'key' => 'booking_form_accent_enabled', | |
| 143 | + 'scope' => 'global', | |
| 144 | + 'save_ui' => 'when_changed', | |
| 145 | + 'autosave_on_form_save' => true, | |
| 146 | + 'default' => $wpbc_bfb_accent_values['booking_form_accent_enabled'], | |
| 147 | + 'label' => __( 'Custom accent color', 'booking' ), | |
| 148 | + 'help' => __( 'Use one accent for preset-style primary buttons, secondary-button hover borders, focused fields, selected choices, and navigation accents. Custom style keeps its explicitly configured button colors. Time slots use the accent only with the Automatic time-slot style.', 'booking' ), | |
| 149 | + 'attr' => array( | |
| 150 | + 'id' => 'booking_form_accent_enabled', | |
| 151 | + ), | |
| 152 | + ) | |
| 153 | + ); | |
| 154 | + | |
| 155 | + WPBC_BFB_Setting_Options::print_option( | |
| 156 | + array( | |
| 157 | + 'type' => 'color', | |
| 158 | + 'key' => 'booking_form_accent_color', | |
| 159 | + 'scope' => 'global', | |
| 160 | + 'save_ui' => 'when_changed', | |
| 161 | + 'autosave_on_form_save' => true, | |
| 162 | + 'default' => $wpbc_bfb_accent_values['booking_form_accent_color'], | |
| 163 | + 'label' => __( 'Accent color', 'booking' ), | |
| 164 | + 'help' => __( 'Choose the shared interactive color. Preset styles calculate readable primary button text and hover colors automatically; Custom style uses its explicit button settings.', 'booking' ), | |
| 165 | + 'attr' => array( | |
| 166 | + 'id' => 'booking_form_accent_color', | |
| 167 | + ), | |
| 168 | + 'row_class' => 'wpbc_bfb__form_setting_global_accent_color wpbc_bfb__form_setting_global_accent_dependent', | |
| 169 | + 'row_hidden' => ( 'On' !== $wpbc_bfb_accent_values['booking_form_accent_enabled'] ), | |
| 170 | + 'input_attrs' => array( | |
| 171 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 172 | + ), | |
| 173 | + ) | |
| 174 | + ); | |
| 175 | + | |
| 176 | + ?> | |
| 177 | + <div class="wpbc_bfb__form_setting wpbc-setting wpbc_bfb__form_setting_global_accent_components wpbc_bfb__form_setting_global_accent_dependent" | |
| 178 | + id="booking_form_accent_apply_to_components" | |
| 179 | + data-scope="ui" | |
| 180 | + data-key="booking_form_accent_apply_to_components" | |
| 181 | + <?php echo ( 'On' === $wpbc_bfb_accent_values['booking_form_accent_enabled'] ) ? '' : ' hidden aria-hidden="true"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> > | |
| 182 | + <div class="inspector__row" style="justify-content:flex-start;"> | |
| 183 | + <div class="inspector__control" style="flex:1 1 auto;"> | |
| 184 | + <button type="button" | |
| 185 | + class="button button-secondary" | |
| 186 | + data-wpbc-bfb-apply-accent-components="1" | |
| 187 | + data-wpbc-u-save-name="booking_timeslot_picker_skin" | |
| 188 | + data-wpbc-u-save-value="/css/time_picker_skins/form_style.css" | |
| 189 | + data-wpbc-u-save-callback="wpbc_bfb_time_picker_skin_saved" | |
| 190 | + data-wpbc-time-picker-skin-current="<?php echo esc_attr( get_bk_option( 'booking_timeslot_picker_skin' ) ); ?>" | |
| 191 | + data-wpbc-time-picker-skin-url="<?php echo esc_url( wpbc_plugin_url( '/css/time_picker_skins/form_style.css' ) ); ?>"> | |
| 192 | + <?php esc_html_e( 'Apply accent to form elements', 'booking' ); ?> | |
| 193 | + </button> | |
| 194 | + <p class="wpbc_bfb__help" style="margin:6px 0 0 0;"> | |
| 195 | + <?php esc_html_e( 'Copy the current accent color into supported elements, such as Steps Timeline, and switch time slots to Automatic — Match Booking Form. Element colors remain editable afterward. Save the form to keep element changes.', 'booking' ); ?> | |
| 196 | + </p> | |
| 197 | + <p class="wpbc_bfb__help" role="status" aria-live="polite" data-wpbc-bfb-accent-components-status="1" style="margin:6px 0 0 0;"></p> | |
| 198 | + </div> | |
| 199 | + </div> | |
| 200 | + </div> | |
| 201 | + <?php | |
| 202 | + | |
| 203 | + // Combined global style selector. It uses the same option as Settings > Theme. | |
| 204 | + WPBC_BFB_Setting_Options::print_option( | |
| 205 | + array( | |
| 206 | + 'type' => 'radio', | |
| 207 | + 'key' => 'booking_form_style', | |
| 208 | + 'scope' => 'global', | |
| 209 | + 'save_ui' => 'when_changed', | |
| 210 | + 'autosave_on_form_save' => true, | |
| 211 | + 'default' => $wpbc_bfb_current_form_style, | |
| 212 | + 'label' => __( 'Form style', 'booking' ), | |
| 213 | + 'help' => __( 'Choose the global form style used by all booking forms.', 'booking' ), | |
| 214 | + 'attr' => array( | |
| 215 | + 'id' => 'booking_form_style', | |
| 216 | + ), | |
| 217 | + 'radio_layout' => 'choice_grid', | |
| 218 | + 'options' => function_exists( 'wpbc_bfb_settings__get_form_style_options' ) ? wpbc_bfb_settings__get_form_style_options() : array( | |
| 219 | + 'light_bordered' => __( 'Light bordered', 'booking' ), | |
| 220 | + 'custom' => __( 'Custom', 'booking' ), | |
| 221 | + ), | |
| 222 | + ) | |
| 223 | + ); | |
| 224 | + | |
| 225 | + WPBC_BFB_Setting_Options::print_option( | |
| 226 | + array( | |
| 227 | + 'type' => 'color', | |
| 228 | + 'key' => 'booking_form_custom_background_color', | |
| 229 | + 'scope' => 'global', | |
| 230 | + 'save_ui' => 'when_changed', | |
| 231 | + 'autosave_on_form_save' => true, | |
| 232 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] : '#ffffff', | |
| 233 | + 'label' => __( 'Background color', 'booking' ), | |
| 234 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 235 | + 'attr' => array( | |
| 236 | + 'id' => 'booking_form_custom_background_color', | |
| 237 | + ), | |
| 238 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 239 | + 'row_hidden' => true, | |
| 240 | + 'input_attrs' => array( | |
| 241 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 242 | + ), | |
| 243 | + ) | |
| 244 | + ); | |
| 245 | + | |
| 246 | + WPBC_BFB_Setting_Options::print_option( | |
| 247 | + array( | |
| 248 | + 'type' => 'color', | |
| 249 | + 'key' => 'booking_form_custom_border_color', | |
| 250 | + 'scope' => 'global', | |
| 251 | + 'save_ui' => 'when_changed', | |
| 252 | + 'autosave_on_form_save' => true, | |
| 253 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] : '#cccccc', | |
| 254 | + 'label' => __( 'Border color', 'booking' ), | |
| 255 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 256 | + 'attr' => array( | |
| 257 | + 'id' => 'booking_form_custom_border_color', | |
| 258 | + ), | |
| 259 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 260 | + 'row_hidden' => true, | |
| 261 | + 'input_attrs' => array( | |
| 262 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 263 | + ), | |
| 264 | + ) | |
| 265 | + ); | |
| 266 | + | |
| 267 | + WPBC_BFB_Setting_Options::print_option( | |
| 268 | + array( | |
| 269 | + 'type' => 'length', | |
| 270 | + 'key' => 'booking_form_custom_border_width', | |
| 271 | + 'scope' => 'global', | |
| 272 | + 'save_ui' => 'when_changed', | |
| 273 | + 'autosave_on_form_save' => true, | |
| 274 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] : '1px', | |
| 275 | + 'label' => __( 'Border width', 'booking' ), | |
| 276 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 277 | + 'attr' => array( | |
| 278 | + 'id' => 'booking_form_custom_border_width', | |
| 279 | + ), | |
| 280 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 281 | + 'row_hidden' => true, | |
| 282 | + 'length' => array( | |
| 283 | + 'default_unit' => 'px', | |
| 284 | + 'units' => array( | |
| 285 | + 'px' => 'px', | |
| 286 | + 'rem' => 'rem', | |
| 287 | + 'em' => 'em', | |
| 288 | + ), | |
| 289 | + 'bounds_map' => array( | |
| 290 | + 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ), | |
| 291 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 292 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 293 | + ), | |
| 294 | + ), | |
| 295 | + ) | |
| 296 | + ); | |
| 297 | + | |
| 298 | + WPBC_BFB_Setting_Options::print_option( | |
| 299 | + array( | |
| 300 | + 'type' => 'length', | |
| 301 | + 'key' => 'booking_form_custom_border_radius', | |
| 302 | + 'scope' => 'global', | |
| 303 | + 'save_ui' => 'when_changed', | |
| 304 | + 'autosave_on_form_save' => true, | |
| 305 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] : '2px', | |
| 306 | + 'label' => __( 'Corner radius', 'booking' ), | |
| 307 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 308 | + 'attr' => array( | |
| 309 | + 'id' => 'booking_form_custom_border_radius', | |
| 310 | + ), | |
| 311 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 312 | + 'row_hidden' => true, | |
| 313 | + 'length' => array( | |
| 314 | + 'default_unit' => 'px', | |
| 315 | + 'units' => array( | |
| 316 | + 'px' => 'px', | |
| 317 | + 'rem' => 'rem', | |
| 318 | + 'em' => 'em', | |
| 319 | + ), | |
| 320 | + 'bounds_map' => array( | |
| 321 | + 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ), | |
| 322 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 323 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 324 | + ), | |
| 325 | + ), | |
| 326 | + ) | |
| 327 | + ); | |
| 328 | + | |
| 329 | + WPBC_BFB_Setting_Options::print_option( | |
| 330 | + array( | |
| 331 | + 'type' => 'length', | |
| 332 | + 'key' => 'booking_form_custom_padding_vertical', | |
| 333 | + 'scope' => 'global', | |
| 334 | + 'save_ui' => 'when_changed', | |
| 335 | + 'autosave_on_form_save' => true, | |
| 336 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] : '10px', | |
| 337 | + 'label' => __( 'Inner spacing top / bottom', 'booking' ), | |
| 338 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 339 | + 'attr' => array( | |
| 340 | + 'id' => 'booking_form_custom_padding_vertical', | |
| 341 | + ), | |
| 342 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 343 | + 'row_hidden' => true, | |
| 344 | + 'length' => array( | |
| 345 | + 'default_unit' => 'px', | |
| 346 | + 'units' => array( | |
| 347 | + 'px' => 'px', | |
| 348 | + 'rem' => 'rem', | |
| 349 | + 'em' => 'em', | |
| 350 | + ), | |
| 351 | + 'bounds_map' => array( | |
| 352 | + 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ), | |
| 353 | + 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ), | |
| 354 | + 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ), | |
| 355 | + ), | |
| 356 | + ), | |
| 357 | + ) | |
| 358 | + ); | |
| 359 | + | |
| 360 | + WPBC_BFB_Setting_Options::print_option( | |
| 361 | + array( | |
| 362 | + 'type' => 'length', | |
| 363 | + 'key' => 'booking_form_custom_padding_horizontal', | |
| 364 | + 'scope' => 'global', | |
| 365 | + 'save_ui' => 'when_changed', | |
| 366 | + 'autosave_on_form_save' => true, | |
| 367 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] : '30px', | |
| 368 | + 'label' => __( 'Inner spacing left / right', 'booking' ), | |
| 369 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 370 | + 'attr' => array( | |
| 371 | + 'id' => 'booking_form_custom_padding_horizontal', | |
| 372 | + ), | |
| 373 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 374 | + 'row_hidden' => true, | |
| 375 | + 'length' => array( | |
| 376 | + 'default_unit' => 'px', | |
| 377 | + 'units' => array( | |
| 378 | + 'px' => 'px', | |
| 379 | + 'rem' => 'rem', | |
| 380 | + 'em' => 'em', | |
| 381 | + ), | |
| 382 | + 'bounds_map' => array( | |
| 383 | + 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ), | |
| 384 | + 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ), | |
| 385 | + 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ), | |
| 386 | + ), | |
| 387 | + ), | |
| 388 | + ) | |
| 389 | + ); | |
| 390 | + | |
| 391 | + WPBC_BFB_Setting_Options::print_option( | |
| 392 | + array( | |
| 393 | + 'type' => 'color', | |
| 394 | + 'key' => 'booking_form_custom_text_color', | |
| 395 | + 'scope' => 'global', | |
| 396 | + 'save_ui' => 'when_changed', | |
| 397 | + 'autosave_on_form_save' => true, | |
| 398 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] : '#1d2327', | |
| 399 | + 'label' => __( 'Text color', 'booking' ), | |
| 400 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 401 | + 'attr' => array( | |
| 402 | + 'id' => 'booking_form_custom_text_color', | |
| 403 | + ), | |
| 404 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 405 | + 'row_hidden' => true, | |
| 406 | + 'input_attrs' => array( | |
| 407 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 408 | + ), | |
| 409 | + ) | |
| 410 | + ); | |
| 411 | + | |
| 412 | + WPBC_BFB_Setting_Options::print_option( | |
| 413 | + array( | |
| 414 | + 'type' => 'color', | |
| 415 | + 'key' => 'booking_form_custom_field_background_color', | |
| 416 | + 'scope' => 'global', | |
| 417 | + 'save_ui' => 'when_changed', | |
| 418 | + 'autosave_on_form_save' => true, | |
| 419 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_field_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_field_background_color'] : '#ffffff', | |
| 420 | + 'label' => __( 'Field background', 'booking' ), | |
| 421 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 422 | + 'attr' => array( | |
| 423 | + 'id' => 'booking_form_custom_field_background_color', | |
| 424 | + ), | |
| 425 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 426 | + 'row_hidden' => true, | |
| 427 | + 'input_attrs' => array( | |
| 428 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 429 | + ), | |
| 430 | + ) | |
| 431 | + ); | |
| 432 | + | |
| 433 | + WPBC_BFB_Setting_Options::print_option( | |
| 434 | + array( | |
| 435 | + 'type' => 'color', | |
| 436 | + 'key' => 'booking_form_custom_field_text_color', | |
| 437 | + 'scope' => 'global', | |
| 438 | + 'save_ui' => 'when_changed', | |
| 439 | + 'autosave_on_form_save' => true, | |
| 440 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_field_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_field_text_color'] : '#3c434a', | |
| 441 | + 'label' => __( 'Field text color', 'booking' ), | |
| 442 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 443 | + 'attr' => array( | |
| 444 | + 'id' => 'booking_form_custom_field_text_color', | |
| 445 | + ), | |
| 446 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 447 | + 'row_hidden' => true, | |
| 448 | + 'input_attrs' => array( | |
| 449 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 450 | + ), | |
| 451 | + ) | |
| 452 | + ); | |
| 453 | + | |
| 454 | + WPBC_BFB_Setting_Options::print_option( | |
| 455 | + array( | |
| 456 | + 'type' => 'color', | |
| 457 | + 'key' => 'booking_form_custom_field_border_color', | |
| 458 | + 'scope' => 'global', | |
| 459 | + 'save_ui' => 'when_changed', | |
| 460 | + 'autosave_on_form_save' => true, | |
| 461 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_field_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_field_border_color'] : '#cccccc', | |
| 462 | + 'label' => __( 'Field border color', 'booking' ), | |
| 463 | + 'help' => __( 'Used when Form style is Custom.', 'booking' ), | |
| 464 | + 'attr' => array( | |
| 465 | + 'id' => 'booking_form_custom_field_border_color', | |
| 466 | + ), | |
| 467 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 468 | + 'row_hidden' => true, | |
| 469 | + 'input_attrs' => array( | |
| 470 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 471 | + ), | |
| 472 | + ) | |
| 473 | + ); | |
| 474 | + | |
| 475 | + WPBC_BFB_Setting_Options::print_option( | |
| 476 | + array( | |
| 477 | + 'type' => 'color', | |
| 478 | + 'key' => 'booking_form_custom_button_background_color', | |
| 479 | + 'scope' => 'global', | |
| 480 | + 'save_ui' => 'when_changed', | |
| 481 | + 'autosave_on_form_save' => true, | |
| 482 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_background_color'] : '#066aab', | |
| 483 | + 'label' => __( 'Primary button background', 'booking' ), | |
| 484 | + 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ), | |
| 485 | + 'attr' => array( | |
| 486 | + 'id' => 'booking_form_custom_button_background_color', | |
| 487 | + ), | |
| 488 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 489 | + 'row_hidden' => true, | |
| 490 | + 'input_attrs' => array( | |
| 491 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 492 | + ), | |
| 493 | + ) | |
| 494 | + ); | |
| 495 | + | |
| 496 | + WPBC_BFB_Setting_Options::print_option( | |
| 497 | + array( | |
| 498 | + 'type' => 'color', | |
| 499 | + 'key' => 'booking_form_custom_button_text_color', | |
| 500 | + 'scope' => 'global', | |
| 501 | + 'save_ui' => 'when_changed', | |
| 502 | + 'autosave_on_form_save' => true, | |
| 503 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_text_color'] : '#ffffff', | |
| 504 | + 'label' => __( 'Primary button text', 'booking' ), | |
| 505 | + 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ), | |
| 506 | + 'attr' => array( | |
| 507 | + 'id' => 'booking_form_custom_button_text_color', | |
| 508 | + ), | |
| 509 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 510 | + 'row_hidden' => true, | |
| 511 | + 'input_attrs' => array( | |
| 512 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 513 | + ), | |
| 514 | + ) | |
| 515 | + ); | |
| 516 | + | |
| 517 | + WPBC_BFB_Setting_Options::print_option( | |
| 518 | + array( | |
| 519 | + 'type' => 'color', | |
| 520 | + 'key' => 'booking_form_custom_button_border_color', | |
| 521 | + 'scope' => 'global', | |
| 522 | + 'save_ui' => 'when_changed', | |
| 523 | + 'autosave_on_form_save' => true, | |
| 524 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_border_color'] : '#066aab', | |
| 525 | + 'label' => __( 'Primary button border', 'booking' ), | |
| 526 | + 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ), | |
| 527 | + 'attr' => array( | |
| 528 | + 'id' => 'booking_form_custom_button_border_color', | |
| 529 | + ), | |
| 530 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 531 | + 'row_hidden' => true, | |
| 532 | + 'input_attrs' => array( | |
| 533 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 534 | + ), | |
| 535 | + ) | |
| 536 | + ); | |
| 537 | + | |
| 538 | + WPBC_BFB_Setting_Options::print_option( | |
| 539 | + array( | |
| 540 | + 'type' => 'color', | |
| 541 | + 'key' => 'booking_form_custom_button_hover_background_color', | |
| 542 | + 'scope' => 'global', | |
| 543 | + 'save_ui' => 'when_changed', | |
| 544 | + 'autosave_on_form_save' => true, | |
| 545 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_background_color'] : '#055589', | |
| 546 | + 'label' => __( 'Primary hover background', 'booking' ), | |
| 547 | + 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ), | |
| 548 | + 'attr' => array( | |
| 549 | + 'id' => 'booking_form_custom_button_hover_background_color', | |
| 550 | + ), | |
| 551 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 552 | + 'row_hidden' => true, | |
| 553 | + 'input_attrs' => array( | |
| 554 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 555 | + ), | |
| 556 | + ) | |
| 557 | + ); | |
| 558 | + | |
| 559 | + WPBC_BFB_Setting_Options::print_option( | |
| 560 | + array( | |
| 561 | + 'type' => 'color', | |
| 562 | + 'key' => 'booking_form_custom_button_hover_text_color', | |
| 563 | + 'scope' => 'global', | |
| 564 | + 'save_ui' => 'when_changed', | |
| 565 | + 'autosave_on_form_save' => true, | |
| 566 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_text_color'] : '#ffffff', | |
| 567 | + 'label' => __( 'Primary hover text', 'booking' ), | |
| 568 | + 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ), | |
| 569 | + 'attr' => array( | |
| 570 | + 'id' => 'booking_form_custom_button_hover_text_color', | |
| 571 | + ), | |
| 572 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 573 | + 'row_hidden' => true, | |
| 574 | + 'input_attrs' => array( | |
| 575 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 576 | + ), | |
| 577 | + ) | |
| 578 | + ); | |
| 579 | + | |
| 580 | + WPBC_BFB_Setting_Options::print_option( | |
| 581 | + array( | |
| 582 | + 'type' => 'color', | |
| 583 | + 'key' => 'booking_form_custom_button_hover_border_color', | |
| 584 | + 'scope' => 'global', | |
| 585 | + 'save_ui' => 'when_changed', | |
| 586 | + 'autosave_on_form_save' => true, | |
| 587 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_hover_border_color'] : '#055589', | |
| 588 | + 'label' => __( 'Primary hover border', 'booking' ), | |
| 589 | + 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ), | |
| 590 | + 'attr' => array( | |
| 591 | + 'id' => 'booking_form_custom_button_hover_border_color', | |
| 592 | + ), | |
| 593 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 594 | + 'row_hidden' => true, | |
| 595 | + 'input_attrs' => array( | |
| 596 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 597 | + ), | |
| 598 | + ) | |
| 599 | + ); | |
| 600 | + | |
| 601 | + $secondary_button_color_options = array( | |
| 602 | + 'booking_form_custom_secondary_button_background_color' => array( __( 'Secondary button background', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#fdfdfd' ), | |
| 603 | + 'booking_form_custom_secondary_button_text_color' => array( __( 'Secondary button text', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#444444' ), | |
| 604 | + 'booking_form_custom_secondary_button_border_color' => array( __( 'Secondary button border', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#eeeeee' ), | |
| 605 | + 'booking_form_custom_secondary_button_hover_background_color' => array( __( 'Secondary hover background', 'booking' ), __( 'Used when a secondary button is hovered, focused, or active.', 'booking' ), '#fdfdfd' ), | |
| 606 | + 'booking_form_custom_secondary_button_hover_text_color' => array( __( 'Secondary hover text', 'booking' ), __( 'Used when a secondary button is hovered, focused, or active.', 'booking' ), '#444444' ), | |
| 607 | + 'booking_form_custom_secondary_button_hover_border_color' => array( __( 'Secondary hover border', 'booking' ), __( 'Used when a secondary button is hovered, focused, or active.', 'booking' ), '#4d91cd' ), | |
| 608 | + ); | |
| 609 | + | |
| 610 | + foreach ( $secondary_button_color_options as $option_key => $option_data ) { | |
| 611 | + WPBC_BFB_Setting_Options::print_option( | |
| 612 | + array( | |
| 613 | + 'type' => 'color', | |
| 614 | + 'key' => $option_key, | |
| 615 | + 'scope' => 'global', | |
| 616 | + 'save_ui' => 'when_changed', | |
| 617 | + 'autosave_on_form_save' => true, | |
| 618 | + 'default' => isset( $wpbc_bfb_custom_style_values[ $option_key ] ) ? $wpbc_bfb_custom_style_values[ $option_key ] : $option_data[2], | |
| 619 | + 'label' => $option_data[0], | |
| 620 | + 'help' => $option_data[1], | |
| 621 | + 'attr' => array( | |
| 622 | + 'id' => $option_key, | |
| 623 | + ), | |
| 624 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 625 | + 'row_hidden' => true, | |
| 626 | + 'input_attrs' => array( | |
| 627 | + 'pattern' => '^#[0-9A-Fa-f]{6}$', | |
| 628 | + ), | |
| 629 | + ) | |
| 630 | + ); | |
| 631 | + } | |
| 632 | + | |
| 633 | + WPBC_BFB_Setting_Options::print_option( | |
| 634 | + array( | |
| 635 | + 'type' => 'length', | |
| 636 | + 'key' => 'booking_form_custom_button_border_width', | |
| 637 | + 'scope' => 'global', | |
| 638 | + 'save_ui' => 'when_changed', | |
| 639 | + 'autosave_on_form_save' => true, | |
| 640 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_border_width'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_border_width'] : '1px', | |
| 641 | + 'label' => __( 'Button border width', 'booking' ), | |
| 642 | + 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ), | |
| 643 | + 'attr' => array( | |
| 644 | + 'id' => 'booking_form_custom_button_border_width', | |
| 645 | + ), | |
| 646 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 647 | + 'row_hidden' => true, | |
| 648 | + 'length' => array( | |
| 649 | + 'default_unit' => 'px', | |
| 650 | + 'units' => array( | |
| 651 | + 'px' => 'px', | |
| 652 | + 'rem' => 'rem', | |
| 653 | + 'em' => 'em', | |
| 654 | + ), | |
| 655 | + 'bounds_map' => array( | |
| 656 | + 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ), | |
| 657 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 658 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 659 | + ), | |
| 660 | + ), | |
| 661 | + ) | |
| 662 | + ); | |
| 663 | + | |
| 664 | + WPBC_BFB_Setting_Options::print_option( | |
| 665 | + array( | |
| 666 | + 'type' => 'length', | |
| 667 | + 'key' => 'booking_form_custom_button_border_radius', | |
| 668 | + 'scope' => 'global', | |
| 669 | + 'save_ui' => 'when_changed', | |
| 670 | + 'autosave_on_form_save' => true, | |
| 671 | + 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_button_border_radius'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_button_border_radius'] : '3px', | |
| 672 | + 'label' => __( 'Button corner radius', 'booking' ), | |
| 673 | + 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ), | |
| 674 | + 'attr' => array( | |
| 675 | + 'id' => 'booking_form_custom_button_border_radius', | |
| 676 | + ), | |
| 677 | + 'row_class' => 'wpbc_bfb__form_setting_global_custom_style', | |
| 678 | + 'row_hidden' => true, | |
| 679 | + 'length' => array( | |
| 680 | + 'default_unit' => 'px', | |
| 681 | + 'units' => array( | |
| 682 | + 'px' => 'px', | |
| 683 | + 'rem' => 'rem', | |
| 684 | + 'em' => 'em', | |
| 685 | + ), | |
| 686 | + 'bounds_map' => array( | |
| 687 | + 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ), | |
| 688 | + 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 689 | + 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ), | |
| 690 | + ), | |
| 691 | + ), | |
| 692 | + ) | |
| 693 | + ); | |
| 694 | + | |
| 695 | + ?> | |
| 696 | + <div class="wpbc_bfb__form_setting wpbc_bfb__form_setting_custom_appearance_reset" data-wpbc-bfb-custom-appearance-reset-row="1" hidden aria-hidden="true" style="border: 1.5px dashed #dd4e4e;"> | |
| 697 | + <div class="inspector__row" style="justify-content:flex-start;"> | |
| 698 | + <div class="inspector__control" style="flex:1 1 auto;"> | |
| 699 | + <button type="button" class="button button-secondary" data-wpbc-bfb-reset-custom-appearance="1" style="margin: 10px auto;display: block;"> | |
| 700 | + <?php esc_html_e( 'Reset custom style', 'booking' ); ?> | |
| 701 | + </button> | |
| 702 | + <p class="wpbc_bfb__help" style="margin:6px 0 0 0;"> | |
| 703 | + <?php esc_html_e( 'Restore the default custom container, spacing, field, and button colors. Save Form also saves these style changes.', 'booking' ); ?> | |
| 704 | + </p> | |
| 705 | + </div> | |
| 706 | + </div> | |
| 707 | + </div> | |
| 708 | + </div> | |
| 709 | + </section> | |
| 710 | + <?php | |
| 711 | + | |
| 712 | + // ====================================================================== | |
| 713 | + // == Group: Advanced | |
| 714 | + // ====================================================================== | |
| 715 | + | |
| 716 | + $panel_id_advanced = 'wpbc_bfb_form_settings_panel_advanced'; | |
| 717 | + ?> | |
| 718 | + <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-advanced"> | |
| 719 | + <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_advanced ); ?>"> | |
| 720 | + <h3><?php esc_html_e( 'Advanced', 'booking' ); ?></h3> | |
| 721 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 722 | + </button> | |
| 723 | + | |
| 724 | + <div class="group__fields" id="<?php echo esc_attr( $panel_id_advanced ); ?>" aria-hidden="true"> | |
| 725 | + <?php | |
| 726 | + | |
| 727 | + WPBC_BFB_Setting_Options::print_option( | |
| 728 | + array( | |
| 729 | + 'type' => 'toggle', | |
| 730 | + 'key' => 'booking_is_use_phone_validation', | |
| 731 | + 'scope' => 'global', | |
| 732 | + 'save_ui' => 'when_changed', // always | when_changed. | |
| 733 | + 'default' => get_bk_option( 'booking_is_use_phone_validation', 'Off' ), | |
| 734 | + 'label' => __( 'Smart phone validation', 'booking' ), | |
| 735 | + 'help' => __( 'Validate phone number fields according to the user’s selected country format (e.g., +1 000 000 0000).', 'booking' ), | |
| 736 | + 'attr' => array( | |
| 737 | + 'id' => 'set_gen_booking_is_use_phone_validation', | |
| 738 | + ), | |
| 739 | + ) | |
| 740 | + ); | |
| 741 | + | |
| 742 | + if ( class_exists( 'wpdev_bk_biz_m' ) ) { | |
| 743 | + WPBC_BFB_Setting_Options::print_option( | |
| 744 | + array( | |
| 745 | + 'type' => 'range', | |
| 746 | + 'key' => 'booking_number_for_pre_checkin_date_hint', | |
| 747 | + 'scope' => 'global', | |
| 748 | + 'save_ui' => 'when_changed', // always | when_changed. | |
| 749 | + 'default' => get_bk_option( 'booking_number_for_pre_checkin_date_hint', '14' ), | |
| 750 | + 'label' => __( 'Pre-check-in display duration', 'booking' ), | |
| 751 | + 'help' => __( 'Select the number of days used by the [pre_checkin_date_hint] shortcode (N days before the selected check-in date).', 'booking' ), | |
| 752 | + 'attr' => array( 'id' => 'set_gen_booking_number_for_pre_checkin_date_hint' ), | |
| 753 | + 'range' => array( 'min' => 1, 'max' => 91, 'step' => 1 ), | |
| 754 | + ) | |
| 755 | + ); | |
| 756 | + } | |
| 757 | + | |
| 758 | + ?> | |
| 759 | + </div> | |
| 760 | + </section> | |
| 761 | + <?php | |
| 762 | + | |
| 763 | + // ====================================================================== | |
| 764 | + // == Group: Calendar | |
| 765 | + // ====================================================================== | |
| 766 | + | |
| 767 | + $panel_id_calendar = 'wpbc_bfb_form_settings_panel_calendar'; | |
| 768 | + ?> | |
| 769 | + <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-calendar"> | |
| 770 | + <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_calendar ); ?>"> | |
| 771 | + <h3><?php esc_html_e( 'Custom Days Selection', 'booking' ); ?></h3> | |
| 772 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 773 | + </button> | |
| 774 | + | |
| 775 | + <div class="group__fields" id="<?php | |
| 776 | + echo esc_attr( $panel_id_calendar ); ?>" aria-hidden="true"> | |
| 777 | + <?php | |
| 778 | + | |
| 779 | + // Days selection in calendar (LOCAL FORM SETTING). | |
| 780 | + WPBC_BFB_Setting_Options::print_option( array( | |
| 781 | + 'type' => 'radio', | |
| 782 | + 'key' => 'booking_type_of_day_selections', | |
| 783 | + 'scope' => 'form', | |
| 784 | + 'default' => '', | |
| 785 | + 'label' => __( 'Days selection mode', 'booking' ), | |
| 786 | + 'help' => __( 'Choose how visitors can select dates in this form’s calendar.', 'booking' ) . ' ' . | |
| 787 | + __( 'Default follows your global setting for the whole site.', 'booking' ) . ' ' . | |
| 788 | + __( 'Click Preview to see it in action.', 'booking' ), | |
| 789 | + 'attr' => array( | |
| 790 | + 'id' => 'booking_type_of_day_selections', | |
| 791 | + ), | |
| 792 | + 'radio_layout' => 'inline', | |
| 793 | + 'options' => array( | |
| 794 | + '' => __( 'Default', 'booking' ) . ' (' . __( 'calendar settings', 'booking' ) . ')', | |
| 795 | + 'single' => __( 'Single day', 'booking' ), | |
| 796 | + 'multiple' => __( 'Multiple days', 'booking' ), | |
| 797 | + 'range' => __( 'Range days - 2 mouse clicks', 'booking' ), | |
| 798 | + ), | |
| 799 | + ) ); | |
| 800 | + | |
| 801 | + ?> | |
| 802 | + </div> | |
| 803 | + </section> | |
| 804 | + <?php | |
| 805 | + | |
| 806 | + | |
| 807 | + if(0){ | |
| 808 | + // ====================================================================== | |
| 809 | + // == Group: Debug | |
| 810 | + // ====================================================================== | |
| 811 | + | |
| 812 | + $panel_id_debug = 'wpbc_bfb_form_settings_panel_debug'; | |
| 813 | + ?> | |
| 814 | + <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-debug"> | |
| 815 | + <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_debug ); ?>"> | |
| 816 | + <h3><?php esc_html_e( 'Debug', 'booking' ); ?></h3> | |
| 817 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> | |
| 818 | + </button> | |
| 819 | + | |
| 820 | + <div class="group__fields" id="<?php echo esc_attr( $panel_id_debug ); ?>" aria-hidden="true"> | |
| 821 | + <?php | |
| 822 | + | |
| 823 | + // UI-only: no save_ui; state comes from JS/UI or defaults. | |
| 824 | + WPBC_BFB_Setting_Options::print_option( | |
| 825 | + array( | |
| 826 | + 'type' => 'toggle', | |
| 827 | + 'key' => 'booking_bfb_preview_mode', | |
| 828 | + 'scope' => 'ui', | |
| 829 | + 'default' => 'On', | |
| 830 | + 'label' => __( 'Preview mode', 'booking' ), | |
| 831 | + 'help' => __( 'Enable live preview rendering while building the form.', 'booking' ), | |
| 832 | + 'attr' => array( | |
| 833 | + 'id' => 'wpbc_bfb__toggle_preview', | |
| 834 | + ), | |
| 835 | + ) | |
| 836 | + ); | |
| 837 | + | |
| 838 | + ?> | |
| 839 | + </div> | |
| 840 | + </section> | |
| 841 | + <?php | |
| 842 | + } | |
| 843 | + | |
| 844 | +} | |