PluginProbe
Booking Calendar / 11.4
Booking Calendar v11.4
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / page-form-builder / form-settings / options-defs.php

options-defs.php in Booking Calendar 11.4, at includes/page-form-builder/form-settings/options-defs.php

715 lines 29.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 info@wpbookingcalendar.com
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
37 // ======================================================================
38 // == Group: Basic
39 // ======================================================================
40
41 $panel_id_basic = 'wpbc_bfb_form_settings_panel_basic';
42 ?>
43 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="settings-basic">
44 <button type="button" class="group__header" role="button" aria-expanded="true" aria-controls="<?php echo esc_attr( $panel_id_basic ); ?>">
45 <h3><?php esc_html_e( 'Basic', 'booking' ); ?></h3>
46 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
47 </button>
48
49 <div class="group__fields" id="<?php echo esc_attr( $panel_id_basic ); ?>" aria-hidden="false">
50 <?php
51
52 WPBC_BFB_Setting_Options::print_option(
53 array(
54 'type' => 'toggle',
55 'key' => 'booking_timeslot_picker',
56 'scope' => 'global',
57 'save_ui' => 'always', // always | when_changed.
58 'default' => get_bk_option( 'booking_timeslot_picker', 'On' ),
59 'label' => __( 'Time picker for time slots', 'booking' ),
60 'help' => __( 'Show time slots as a time picker instead of a select box.', 'booking' ),
61 'attr' => array(
62 'id' => 'wpbc_bfb__toggle_booking_timeslot_picker',
63 'class' => 'js-toggle-timeslot-picker',
64 ),
65 )
66 );
67
68 WPBC_BFB_Setting_Options::print_option(
69 array(
70 'type' => 'toggle',
71 'key' => 'booking_is_use_autofill_4_logged_user',
72 'scope' => 'global',
73 'save_ui' => 'when_changed', // always | when_changed.
74 'default' => get_bk_option( 'booking_is_use_autofill_4_logged_user', 'Off' ),
75 'label' => __( 'Auto-fill fields', 'booking' ),
76 'help' => __( 'Prefill form fields with the current user’s details when the user is logged in.', 'booking' ) . ' ' .
77 __( 'Click Preview to see it in action.', 'booking' ),
78 'attr' => array(
79 'id' => 'wpbc_bfb__checkbox_autofill_4_logged_user',
80 ),
81 )
82 );
83
84 ?>
85 </div>
86 </section>
87 <?php
88
89 // ======================================================================
90 // == Group: Appearance
91 // ======================================================================
92
93 $panel_id_appearance = 'wpbc_bfb_form_settings_panel_appearance';
94 ?>
95 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-appearance">
96 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_appearance ); ?>">
97 <h3><?php esc_html_e( 'Appearance', 'booking' ); ?></h3>
98 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
99 </button>
100
101 <div class="group__fields" id="<?php echo esc_attr( $panel_id_appearance ); ?>" aria-hidden="true">
102 <?php
103
104 // Form width (LOCAL FORM SETTING) stored as ONE combined value like "100%".
105 WPBC_BFB_Setting_Options::print_option(
106 array(
107 'type' => 'length',
108 'key' => 'booking_form_layout_width',
109 'scope' => 'form',
110 'default' => '100%', // Applied from JS too; this is a fallback.
111 'label' => __( 'Form width', 'booking' ),
112 'help' => __( 'Set the width of the booking form container.', 'booking' ),
113 'attr' => array(
114 'id' => 'booking_form_layout_width',
115 ),
116 'length' => array(
117 'default_unit' => '%',
118 'units' => array(
119 '%' => '%',
120 'px' => 'px',
121 'rem' => 'rem',
122 'em' => 'em',
123 ),
124 'bounds_map' => array(
125 '%' => array( 'min' => 30, 'max' => 100, 'step' => 1 ),
126 'px' => array( 'min' => 300, 'max' => 2000, 'step' => 10 ),
127 'rem' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ),
128 'em' => array( 'min' => 10, 'max' => 200, 'step' => 0.5 ),
129 ),
130 ),
131 )
132 );
133
134
135 // Combined global style selector. It uses the same option as Settings > Theme.
136 WPBC_BFB_Setting_Options::print_option(
137 array(
138 'type' => 'radio',
139 'key' => 'booking_form_style',
140 'scope' => 'global',
141 'save_ui' => 'when_changed',
142 'autosave_on_form_save' => true,
143 'default' => $wpbc_bfb_current_form_style,
144 'label' => __( 'Form style', 'booking' ),
145 'help' => __( 'Choose the global form style used by all booking forms.', 'booking' ),
146 'attr' => array(
147 'id' => 'booking_form_style',
148 ),
149 'radio_layout' => 'choice_grid',
150 'options' => function_exists( 'wpbc_bfb_settings__get_form_style_options' ) ? wpbc_bfb_settings__get_form_style_options() : array(
151 'light_bordered' => __( 'Light bordered', 'booking' ),
152 'custom' => __( 'Custom', 'booking' ),
153 ),
154 )
155 );
156
157 WPBC_BFB_Setting_Options::print_option(
158 array(
159 'type' => 'color',
160 'key' => 'booking_form_custom_background_color',
161 'scope' => 'global',
162 'save_ui' => 'when_changed',
163 'autosave_on_form_save' => true,
164 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] : '#ffffff',
165 'label' => __( 'Background color', 'booking' ),
166 'help' => __( 'Used when Form style is Custom.', 'booking' ),
167 'attr' => array(
168 'id' => 'booking_form_custom_background_color',
169 ),
170 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
171 'row_hidden' => true,
172 'input_attrs' => array(
173 'pattern' => '^#[0-9A-Fa-f]{6}$',
174 ),
175 )
176 );
177
178 WPBC_BFB_Setting_Options::print_option(
179 array(
180 'type' => 'color',
181 'key' => 'booking_form_custom_border_color',
182 'scope' => 'global',
183 'save_ui' => 'when_changed',
184 'autosave_on_form_save' => true,
185 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] : '#cccccc',
186 'label' => __( 'Border color', 'booking' ),
187 'help' => __( 'Used when Form style is Custom.', 'booking' ),
188 'attr' => array(
189 'id' => 'booking_form_custom_border_color',
190 ),
191 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
192 'row_hidden' => true,
193 'input_attrs' => array(
194 'pattern' => '^#[0-9A-Fa-f]{6}$',
195 ),
196 )
197 );
198
199 WPBC_BFB_Setting_Options::print_option(
200 array(
201 'type' => 'length',
202 'key' => 'booking_form_custom_border_width',
203 'scope' => 'global',
204 'save_ui' => 'when_changed',
205 'autosave_on_form_save' => true,
206 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] : '1px',
207 'label' => __( 'Border width', 'booking' ),
208 'help' => __( 'Used when Form style is Custom.', 'booking' ),
209 'attr' => array(
210 'id' => 'booking_form_custom_border_width',
211 ),
212 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
213 'row_hidden' => true,
214 'length' => array(
215 'default_unit' => 'px',
216 'units' => array(
217 'px' => 'px',
218 'rem' => 'rem',
219 'em' => 'em',
220 ),
221 'bounds_map' => array(
222 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ),
223 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
224 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
225 ),
226 ),
227 )
228 );
229
230 WPBC_BFB_Setting_Options::print_option(
231 array(
232 'type' => 'length',
233 'key' => 'booking_form_custom_border_radius',
234 'scope' => 'global',
235 'save_ui' => 'when_changed',
236 'autosave_on_form_save' => true,
237 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] : '2px',
238 'label' => __( 'Corner radius', 'booking' ),
239 'help' => __( 'Used when Form style is Custom.', 'booking' ),
240 'attr' => array(
241 'id' => 'booking_form_custom_border_radius',
242 ),
243 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
244 'row_hidden' => true,
245 'length' => array(
246 'default_unit' => 'px',
247 'units' => array(
248 'px' => 'px',
249 'rem' => 'rem',
250 'em' => 'em',
251 ),
252 'bounds_map' => array(
253 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ),
254 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
255 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
256 ),
257 ),
258 )
259 );
260
261 WPBC_BFB_Setting_Options::print_option(
262 array(
263 'type' => 'length',
264 'key' => 'booking_form_custom_padding_vertical',
265 'scope' => 'global',
266 'save_ui' => 'when_changed',
267 'autosave_on_form_save' => true,
268 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] : '10px',
269 'label' => __( 'Inner spacing top / bottom', 'booking' ),
270 'help' => __( 'Used when Form style is Custom.', 'booking' ),
271 'attr' => array(
272 'id' => 'booking_form_custom_padding_vertical',
273 ),
274 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
275 'row_hidden' => true,
276 'length' => array(
277 'default_unit' => 'px',
278 'units' => array(
279 'px' => 'px',
280 'rem' => 'rem',
281 'em' => 'em',
282 ),
283 'bounds_map' => array(
284 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ),
285 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
286 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
287 ),
288 ),
289 )
290 );
291
292 WPBC_BFB_Setting_Options::print_option(
293 array(
294 'type' => 'length',
295 'key' => 'booking_form_custom_padding_horizontal',
296 'scope' => 'global',
297 'save_ui' => 'when_changed',
298 'autosave_on_form_save' => true,
299 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] : '30px',
300 'label' => __( 'Inner spacing left / right', 'booking' ),
301 'help' => __( 'Used when Form style is Custom.', 'booking' ),
302 'attr' => array(
303 'id' => 'booking_form_custom_padding_horizontal',
304 ),
305 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
306 'row_hidden' => true,
307 'length' => array(
308 'default_unit' => 'px',
309 'units' => array(
310 'px' => 'px',
311 'rem' => 'rem',
312 'em' => 'em',
313 ),
314 'bounds_map' => array(
315 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ),
316 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
317 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
318 ),
319 ),
320 )
321 );
322
323 WPBC_BFB_Setting_Options::print_option(
324 array(
325 'type' => 'color',
326 'key' => 'booking_form_custom_text_color',
327 'scope' => 'global',
328 'save_ui' => 'when_changed',
329 'autosave_on_form_save' => true,
330 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] : '#1d2327',
331 'label' => __( 'Text color', 'booking' ),
332 'help' => __( 'Used when Form style is Custom.', 'booking' ),
333 'attr' => array(
334 'id' => 'booking_form_custom_text_color',
335 ),
336 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
337 'row_hidden' => true,
338 'input_attrs' => array(
339 'pattern' => '^#[0-9A-Fa-f]{6}$',
340 ),
341 )
342 );
343
344 WPBC_BFB_Setting_Options::print_option(
345 array(
346 'type' => 'color',
347 'key' => 'booking_form_custom_field_background_color',
348 'scope' => 'global',
349 'save_ui' => 'when_changed',
350 'autosave_on_form_save' => true,
351 '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',
352 'label' => __( 'Field background', 'booking' ),
353 'help' => __( 'Used when Form style is Custom.', 'booking' ),
354 'attr' => array(
355 'id' => 'booking_form_custom_field_background_color',
356 ),
357 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
358 'row_hidden' => true,
359 'input_attrs' => array(
360 'pattern' => '^#[0-9A-Fa-f]{6}$',
361 ),
362 )
363 );
364
365 WPBC_BFB_Setting_Options::print_option(
366 array(
367 'type' => 'color',
368 'key' => 'booking_form_custom_field_text_color',
369 'scope' => 'global',
370 'save_ui' => 'when_changed',
371 'autosave_on_form_save' => true,
372 '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',
373 'label' => __( 'Field text color', 'booking' ),
374 'help' => __( 'Used when Form style is Custom.', 'booking' ),
375 'attr' => array(
376 'id' => 'booking_form_custom_field_text_color',
377 ),
378 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
379 'row_hidden' => true,
380 'input_attrs' => array(
381 'pattern' => '^#[0-9A-Fa-f]{6}$',
382 ),
383 )
384 );
385
386 WPBC_BFB_Setting_Options::print_option(
387 array(
388 'type' => 'color',
389 'key' => 'booking_form_custom_field_border_color',
390 'scope' => 'global',
391 'save_ui' => 'when_changed',
392 'autosave_on_form_save' => true,
393 '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',
394 'label' => __( 'Field border color', 'booking' ),
395 'help' => __( 'Used when Form style is Custom.', 'booking' ),
396 'attr' => array(
397 'id' => 'booking_form_custom_field_border_color',
398 ),
399 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
400 'row_hidden' => true,
401 'input_attrs' => array(
402 'pattern' => '^#[0-9A-Fa-f]{6}$',
403 ),
404 )
405 );
406
407 WPBC_BFB_Setting_Options::print_option(
408 array(
409 'type' => 'color',
410 'key' => 'booking_form_custom_button_background_color',
411 'scope' => 'global',
412 'save_ui' => 'when_changed',
413 'autosave_on_form_save' => true,
414 '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',
415 'label' => __( 'Primary button background', 'booking' ),
416 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
417 'attr' => array(
418 'id' => 'booking_form_custom_button_background_color',
419 ),
420 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
421 'row_hidden' => true,
422 'input_attrs' => array(
423 'pattern' => '^#[0-9A-Fa-f]{6}$',
424 ),
425 )
426 );
427
428 WPBC_BFB_Setting_Options::print_option(
429 array(
430 'type' => 'color',
431 'key' => 'booking_form_custom_button_text_color',
432 'scope' => 'global',
433 'save_ui' => 'when_changed',
434 'autosave_on_form_save' => true,
435 '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',
436 'label' => __( 'Primary button text', 'booking' ),
437 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
438 'attr' => array(
439 'id' => 'booking_form_custom_button_text_color',
440 ),
441 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
442 'row_hidden' => true,
443 'input_attrs' => array(
444 'pattern' => '^#[0-9A-Fa-f]{6}$',
445 ),
446 )
447 );
448
449 WPBC_BFB_Setting_Options::print_option(
450 array(
451 'type' => 'color',
452 'key' => 'booking_form_custom_button_border_color',
453 'scope' => 'global',
454 'save_ui' => 'when_changed',
455 'autosave_on_form_save' => true,
456 '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',
457 'label' => __( 'Primary button border', 'booking' ),
458 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
459 'attr' => array(
460 'id' => 'booking_form_custom_button_border_color',
461 ),
462 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
463 'row_hidden' => true,
464 'input_attrs' => array(
465 'pattern' => '^#[0-9A-Fa-f]{6}$',
466 ),
467 )
468 );
469
470 WPBC_BFB_Setting_Options::print_option(
471 array(
472 'type' => 'color',
473 'key' => 'booking_form_custom_button_hover_background_color',
474 'scope' => 'global',
475 'save_ui' => 'when_changed',
476 'autosave_on_form_save' => true,
477 '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',
478 'label' => __( 'Primary hover background', 'booking' ),
479 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
480 'attr' => array(
481 'id' => 'booking_form_custom_button_hover_background_color',
482 ),
483 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
484 'row_hidden' => true,
485 'input_attrs' => array(
486 'pattern' => '^#[0-9A-Fa-f]{6}$',
487 ),
488 )
489 );
490
491 WPBC_BFB_Setting_Options::print_option(
492 array(
493 'type' => 'color',
494 'key' => 'booking_form_custom_button_hover_text_color',
495 'scope' => 'global',
496 'save_ui' => 'when_changed',
497 'autosave_on_form_save' => true,
498 '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',
499 'label' => __( 'Primary hover text', 'booking' ),
500 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
501 'attr' => array(
502 'id' => 'booking_form_custom_button_hover_text_color',
503 ),
504 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
505 'row_hidden' => true,
506 'input_attrs' => array(
507 'pattern' => '^#[0-9A-Fa-f]{6}$',
508 ),
509 )
510 );
511
512 WPBC_BFB_Setting_Options::print_option(
513 array(
514 'type' => 'color',
515 'key' => 'booking_form_custom_button_hover_border_color',
516 'scope' => 'global',
517 'save_ui' => 'when_changed',
518 'autosave_on_form_save' => true,
519 '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',
520 'label' => __( 'Primary hover border', 'booking' ),
521 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
522 'attr' => array(
523 'id' => 'booking_form_custom_button_hover_border_color',
524 ),
525 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
526 'row_hidden' => true,
527 'input_attrs' => array(
528 'pattern' => '^#[0-9A-Fa-f]{6}$',
529 ),
530 )
531 );
532
533 $secondary_button_color_options = array(
534 'booking_form_custom_secondary_button_background_color' => array( __( 'Secondary button background', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#fdfdfd' ),
535 'booking_form_custom_secondary_button_text_color' => array( __( 'Secondary button text', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#444444' ),
536 'booking_form_custom_secondary_button_border_color' => array( __( 'Secondary button border', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#eeeeee' ),
537 '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' ),
538 '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' ),
539 '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' ),
540 );
541
542 foreach ( $secondary_button_color_options as $option_key => $option_data ) {
543 WPBC_BFB_Setting_Options::print_option(
544 array(
545 'type' => 'color',
546 'key' => $option_key,
547 'scope' => 'global',
548 'save_ui' => 'when_changed',
549 'autosave_on_form_save' => true,
550 'default' => isset( $wpbc_bfb_custom_style_values[ $option_key ] ) ? $wpbc_bfb_custom_style_values[ $option_key ] : $option_data[2],
551 'label' => $option_data[0],
552 'help' => $option_data[1],
553 'attr' => array(
554 'id' => $option_key,
555 ),
556 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
557 'row_hidden' => true,
558 'input_attrs' => array(
559 'pattern' => '^#[0-9A-Fa-f]{6}$',
560 ),
561 )
562 );
563 }
564
565 ?>
566 <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;">
567 <div class="inspector__row" style="justify-content:flex-start;">
568 <div class="inspector__control" style="flex:1 1 auto;">
569 <button type="button" class="button button-secondary" data-wpbc-bfb-reset-custom-appearance="1" style="margin: 10px auto;display: block;">
570 <?php esc_html_e( 'Reset custom style', 'booking' ); ?>
571 </button>
572 <p class="wpbc_bfb__help" style="margin:6px 0 0 0;">
573 <?php esc_html_e( 'Restore the default custom container, spacing, field, and button colors. Save Form also saves these style changes.', 'booking' ); ?>
574 </p>
575 </div>
576 </div>
577 </div>
578 </div>
579 </section>
580 <?php
581
582 // ======================================================================
583 // == Group: Advanced
584 // ======================================================================
585
586 $panel_id_advanced = 'wpbc_bfb_form_settings_panel_advanced';
587 ?>
588 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-advanced">
589 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_advanced ); ?>">
590 <h3><?php esc_html_e( 'Advanced', 'booking' ); ?></h3>
591 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
592 </button>
593
594 <div class="group__fields" id="<?php echo esc_attr( $panel_id_advanced ); ?>" aria-hidden="true">
595 <?php
596
597 WPBC_BFB_Setting_Options::print_option(
598 array(
599 'type' => 'toggle',
600 'key' => 'booking_is_use_phone_validation',
601 'scope' => 'global',
602 'save_ui' => 'when_changed', // always | when_changed.
603 'default' => get_bk_option( 'booking_is_use_phone_validation', 'Off' ),
604 'label' => __( 'Smart phone validation', 'booking' ),
605 'help' => __( 'Validate phone number fields according to the user’s selected country format (e.g., +1 000 000 0000).', 'booking' ),
606 'attr' => array(
607 'id' => 'set_gen_booking_is_use_phone_validation',
608 ),
609 )
610 );
611
612 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
613 WPBC_BFB_Setting_Options::print_option(
614 array(
615 'type' => 'range',
616 'key' => 'booking_number_for_pre_checkin_date_hint',
617 'scope' => 'global',
618 'save_ui' => 'when_changed', // always | when_changed.
619 'default' => get_bk_option( 'booking_number_for_pre_checkin_date_hint', '14' ),
620 'label' => __( 'Pre-check-in display duration', 'booking' ),
621 'help' => __( 'Select the number of days used by the [pre_checkin_date_hint] shortcode (N days before the selected check-in date).', 'booking' ),
622 'attr' => array( 'id' => 'set_gen_booking_number_for_pre_checkin_date_hint' ),
623 'range' => array( 'min' => 1, 'max' => 91, 'step' => 1 ),
624 )
625 );
626 }
627
628 ?>
629 </div>
630 </section>
631 <?php
632
633 // ======================================================================
634 // == Group: Calendar
635 // ======================================================================
636
637 $panel_id_calendar = 'wpbc_bfb_form_settings_panel_calendar';
638 ?>
639 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-calendar">
640 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_calendar ); ?>">
641 <h3><?php esc_html_e( 'Custom Days Selection', 'booking' ); ?></h3>
642 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
643 </button>
644
645 <div class="group__fields" id="<?php
646 echo esc_attr( $panel_id_calendar ); ?>" aria-hidden="true">
647 <?php
648
649 // Days selection in calendar (LOCAL FORM SETTING).
650 WPBC_BFB_Setting_Options::print_option( array(
651 'type' => 'radio',
652 'key' => 'booking_type_of_day_selections',
653 'scope' => 'form',
654 'default' => '',
655 'label' => __( 'Days selection mode', 'booking' ),
656 'help' => __( 'Choose how visitors can select dates in this form’s calendar.', 'booking' ) . ' ' .
657 __( 'Default follows your global setting for the whole site.', 'booking' ) . ' ' .
658 __( 'Click Preview to see it in action.', 'booking' ),
659 'attr' => array(
660 'id' => 'booking_type_of_day_selections',
661 ),
662 'radio_layout' => 'inline',
663 'options' => array(
664 '' => __( 'Default', 'booking' ) . ' (' . __( 'calendar settings', 'booking' ) . ')',
665 'single' => __( 'Single day', 'booking' ),
666 'multiple' => __( 'Multiple days', 'booking' ),
667 'range' => __( 'Range days - 2 mouse clicks', 'booking' ),
668 ),
669 ) );
670
671 ?>
672 </div>
673 </section>
674 <?php
675
676
677 if(0){
678 // ======================================================================
679 // == Group: Debug
680 // ======================================================================
681
682 $panel_id_debug = 'wpbc_bfb_form_settings_panel_debug';
683 ?>
684 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-debug">
685 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_debug ); ?>">
686 <h3><?php esc_html_e( 'Debug', 'booking' ); ?></h3>
687 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
688 </button>
689
690 <div class="group__fields" id="<?php echo esc_attr( $panel_id_debug ); ?>" aria-hidden="true">
691 <?php
692
693 // UI-only: no save_ui; state comes from JS/UI or defaults.
694 WPBC_BFB_Setting_Options::print_option(
695 array(
696 'type' => 'toggle',
697 'key' => 'booking_bfb_preview_mode',
698 'scope' => 'ui',
699 'default' => 'On',
700 'label' => __( 'Preview mode', 'booking' ),
701 'help' => __( 'Enable live preview rendering while building the form.', 'booking' ),
702 'attr' => array(
703 'id' => 'wpbc_bfb__toggle_preview',
704 ),
705 )
706 );
707
708 ?>
709 </div>
710 </section>
711 <?php
712 }
713
714 }
715