PluginProbe
Booking Calendar / 11.6
Booking Calendar v11.6
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.6, at includes/page-form-builder/form-settings/options-defs.php

847 lines 36.5 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 $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-action="wpbc_bfb_save_time_picker_skin"
189 data-wpbc-u-save-nonce="<?php echo esc_attr( wp_create_nonce( 'wpbc_bfb_save_time_picker_skin' ) ); ?>"
190 data-wpbc-u-save-value="/css/time_picker_skins/form_style.css"
191 data-wpbc-u-save-callback="wpbc_bfb_time_picker_skin_saved"
192 data-wpbc-time-picker-skin-current="<?php echo esc_attr( get_bk_option( 'booking_timeslot_picker_skin' ) ); ?>"
193 data-wpbc-time-picker-skin-url="<?php echo esc_url( wpbc_plugin_url( '/css/time_picker_skins/form_style.css' ) ); ?>">
194 <?php esc_html_e( 'Apply accent to form elements', 'booking' ); ?>
195 </button>
196 <p class="wpbc_bfb__help" style="margin:6px 0 0 0;">
197 <?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' ); ?>
198 </p>
199 <p class="wpbc_bfb__help" role="status" aria-live="polite" data-wpbc-bfb-accent-components-status="1" style="margin:6px 0 0 0;"></p>
200 </div>
201 </div>
202 </div>
203 <?php
204
205 // Combined global style selector. It uses the same option as Settings > Theme.
206 WPBC_BFB_Setting_Options::print_option(
207 array(
208 'type' => 'radio',
209 'key' => 'booking_form_style',
210 'scope' => 'global',
211 'save_ui' => 'when_changed',
212 'autosave_on_form_save' => true,
213 'default' => $wpbc_bfb_current_form_style,
214 'label' => __( 'Form style', 'booking' ),
215 'help' => __( 'Choose the global form style used by all booking forms.', 'booking' ),
216 'attr' => array(
217 'id' => 'booking_form_style',
218 ),
219 'radio_layout' => 'choice_grid',
220 'options' => function_exists( 'wpbc_bfb_settings__get_form_style_options' ) ? wpbc_bfb_settings__get_form_style_options() : array(
221 'light_bordered' => __( 'Light bordered', 'booking' ),
222 'custom' => __( 'Custom', 'booking' ),
223 ),
224 )
225 );
226
227 WPBC_BFB_Setting_Options::print_option(
228 array(
229 'type' => 'color',
230 'key' => 'booking_form_custom_background_color',
231 'scope' => 'global',
232 'save_ui' => 'when_changed',
233 'autosave_on_form_save' => true,
234 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_background_color'] : '#ffffff',
235 'label' => __( 'Background color', 'booking' ),
236 'help' => __( 'Used when Form style is Custom.', 'booking' ),
237 'attr' => array(
238 'id' => 'booking_form_custom_background_color',
239 ),
240 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
241 'row_hidden' => true,
242 'input_attrs' => array(
243 'pattern' => '^#[0-9A-Fa-f]{6}$',
244 ),
245 )
246 );
247
248 WPBC_BFB_Setting_Options::print_option(
249 array(
250 'type' => 'color',
251 'key' => 'booking_form_custom_border_color',
252 'scope' => 'global',
253 'save_ui' => 'when_changed',
254 'autosave_on_form_save' => true,
255 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_color'] : '#cccccc',
256 'label' => __( 'Border color', 'booking' ),
257 'help' => __( 'Used when Form style is Custom.', 'booking' ),
258 'attr' => array(
259 'id' => 'booking_form_custom_border_color',
260 ),
261 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
262 'row_hidden' => true,
263 'input_attrs' => array(
264 'pattern' => '^#[0-9A-Fa-f]{6}$',
265 ),
266 )
267 );
268
269 WPBC_BFB_Setting_Options::print_option(
270 array(
271 'type' => 'length',
272 'key' => 'booking_form_custom_border_width',
273 'scope' => 'global',
274 'save_ui' => 'when_changed',
275 'autosave_on_form_save' => true,
276 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_width'] : '1px',
277 'label' => __( 'Border width', 'booking' ),
278 'help' => __( 'Used when Form style is Custom.', 'booking' ),
279 'attr' => array(
280 'id' => 'booking_form_custom_border_width',
281 ),
282 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
283 'row_hidden' => true,
284 'length' => array(
285 'default_unit' => 'px',
286 'units' => array(
287 'px' => 'px',
288 'rem' => 'rem',
289 'em' => 'em',
290 ),
291 'bounds_map' => array(
292 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ),
293 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
294 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
295 ),
296 ),
297 )
298 );
299
300 WPBC_BFB_Setting_Options::print_option(
301 array(
302 'type' => 'length',
303 'key' => 'booking_form_custom_border_radius',
304 'scope' => 'global',
305 'save_ui' => 'when_changed',
306 'autosave_on_form_save' => true,
307 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_border_radius'] : '2px',
308 'label' => __( 'Corner radius', 'booking' ),
309 'help' => __( 'Used when Form style is Custom.', 'booking' ),
310 'attr' => array(
311 'id' => 'booking_form_custom_border_radius',
312 ),
313 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
314 'row_hidden' => true,
315 'length' => array(
316 'default_unit' => 'px',
317 'units' => array(
318 'px' => 'px',
319 'rem' => 'rem',
320 'em' => 'em',
321 ),
322 'bounds_map' => array(
323 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ),
324 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
325 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
326 ),
327 ),
328 )
329 );
330
331 WPBC_BFB_Setting_Options::print_option(
332 array(
333 'type' => 'length',
334 'key' => 'booking_form_custom_padding_vertical',
335 'scope' => 'global',
336 'save_ui' => 'when_changed',
337 'autosave_on_form_save' => true,
338 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_vertical'] : '10px',
339 'label' => __( 'Inner spacing top / bottom', 'booking' ),
340 'help' => __( 'Used when Form style is Custom.', 'booking' ),
341 'attr' => array(
342 'id' => 'booking_form_custom_padding_vertical',
343 ),
344 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
345 'row_hidden' => true,
346 'length' => array(
347 'default_unit' => 'px',
348 'units' => array(
349 'px' => 'px',
350 'rem' => 'rem',
351 'em' => 'em',
352 ),
353 'bounds_map' => array(
354 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ),
355 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
356 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
357 ),
358 ),
359 )
360 );
361
362 WPBC_BFB_Setting_Options::print_option(
363 array(
364 'type' => 'length',
365 'key' => 'booking_form_custom_padding_horizontal',
366 'scope' => 'global',
367 'save_ui' => 'when_changed',
368 'autosave_on_form_save' => true,
369 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_padding_horizontal'] : '30px',
370 'label' => __( 'Inner spacing left / right', 'booking' ),
371 'help' => __( 'Used when Form style is Custom.', 'booking' ),
372 'attr' => array(
373 'id' => 'booking_form_custom_padding_horizontal',
374 ),
375 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
376 'row_hidden' => true,
377 'length' => array(
378 'default_unit' => 'px',
379 'units' => array(
380 'px' => 'px',
381 'rem' => 'rem',
382 'em' => 'em',
383 ),
384 'bounds_map' => array(
385 'px' => array( 'min' => 0, 'max' => 120, 'step' => 1 ),
386 'rem' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
387 'em' => array( 'min' => 0, 'max' => 10, 'step' => 0.1 ),
388 ),
389 ),
390 )
391 );
392
393 WPBC_BFB_Setting_Options::print_option(
394 array(
395 'type' => 'color',
396 'key' => 'booking_form_custom_text_color',
397 'scope' => 'global',
398 'save_ui' => 'when_changed',
399 'autosave_on_form_save' => true,
400 'default' => isset( $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] ) ? $wpbc_bfb_custom_style_values['booking_form_custom_text_color'] : '#1d2327',
401 'label' => __( 'Text color', 'booking' ),
402 'help' => __( 'Used when Form style is Custom.', 'booking' ),
403 'attr' => array(
404 'id' => 'booking_form_custom_text_color',
405 ),
406 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
407 'row_hidden' => true,
408 'input_attrs' => array(
409 'pattern' => '^#[0-9A-Fa-f]{6}$',
410 ),
411 )
412 );
413
414 WPBC_BFB_Setting_Options::print_option(
415 array(
416 'type' => 'color',
417 'key' => 'booking_form_custom_field_background_color',
418 'scope' => 'global',
419 'save_ui' => 'when_changed',
420 'autosave_on_form_save' => true,
421 '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',
422 'label' => __( 'Field background', 'booking' ),
423 'help' => __( 'Used when Form style is Custom.', 'booking' ),
424 'attr' => array(
425 'id' => 'booking_form_custom_field_background_color',
426 ),
427 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
428 'row_hidden' => true,
429 'input_attrs' => array(
430 'pattern' => '^#[0-9A-Fa-f]{6}$',
431 ),
432 )
433 );
434
435 WPBC_BFB_Setting_Options::print_option(
436 array(
437 'type' => 'color',
438 'key' => 'booking_form_custom_field_text_color',
439 'scope' => 'global',
440 'save_ui' => 'when_changed',
441 'autosave_on_form_save' => true,
442 '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',
443 'label' => __( 'Field text color', 'booking' ),
444 'help' => __( 'Used when Form style is Custom.', 'booking' ),
445 'attr' => array(
446 'id' => 'booking_form_custom_field_text_color',
447 ),
448 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
449 'row_hidden' => true,
450 'input_attrs' => array(
451 'pattern' => '^#[0-9A-Fa-f]{6}$',
452 ),
453 )
454 );
455
456 WPBC_BFB_Setting_Options::print_option(
457 array(
458 'type' => 'color',
459 'key' => 'booking_form_custom_field_border_color',
460 'scope' => 'global',
461 'save_ui' => 'when_changed',
462 'autosave_on_form_save' => true,
463 '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',
464 'label' => __( 'Field border color', 'booking' ),
465 'help' => __( 'Used when Form style is Custom.', 'booking' ),
466 'attr' => array(
467 'id' => 'booking_form_custom_field_border_color',
468 ),
469 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
470 'row_hidden' => true,
471 'input_attrs' => array(
472 'pattern' => '^#[0-9A-Fa-f]{6}$',
473 ),
474 )
475 );
476
477 WPBC_BFB_Setting_Options::print_option(
478 array(
479 'type' => 'color',
480 'key' => 'booking_form_custom_button_background_color',
481 'scope' => 'global',
482 'save_ui' => 'when_changed',
483 'autosave_on_form_save' => true,
484 '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',
485 'label' => __( 'Primary button background', 'booking' ),
486 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
487 'attr' => array(
488 'id' => 'booking_form_custom_button_background_color',
489 ),
490 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
491 'row_hidden' => true,
492 'input_attrs' => array(
493 'pattern' => '^#[0-9A-Fa-f]{6}$',
494 ),
495 )
496 );
497
498 WPBC_BFB_Setting_Options::print_option(
499 array(
500 'type' => 'color',
501 'key' => 'booking_form_custom_button_text_color',
502 'scope' => 'global',
503 'save_ui' => 'when_changed',
504 'autosave_on_form_save' => true,
505 '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',
506 'label' => __( 'Primary button text', 'booking' ),
507 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
508 'attr' => array(
509 'id' => 'booking_form_custom_button_text_color',
510 ),
511 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
512 'row_hidden' => true,
513 'input_attrs' => array(
514 'pattern' => '^#[0-9A-Fa-f]{6}$',
515 ),
516 )
517 );
518
519 WPBC_BFB_Setting_Options::print_option(
520 array(
521 'type' => 'color',
522 'key' => 'booking_form_custom_button_border_color',
523 'scope' => 'global',
524 'save_ui' => 'when_changed',
525 'autosave_on_form_save' => true,
526 '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',
527 'label' => __( 'Primary button border', 'booking' ),
528 'help' => __( 'Used by submit and primary buttons when Form style is Custom.', 'booking' ),
529 'attr' => array(
530 'id' => 'booking_form_custom_button_border_color',
531 ),
532 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
533 'row_hidden' => true,
534 'input_attrs' => array(
535 'pattern' => '^#[0-9A-Fa-f]{6}$',
536 ),
537 )
538 );
539
540 WPBC_BFB_Setting_Options::print_option(
541 array(
542 'type' => 'color',
543 'key' => 'booking_form_custom_button_hover_background_color',
544 'scope' => 'global',
545 'save_ui' => 'when_changed',
546 'autosave_on_form_save' => true,
547 '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',
548 'label' => __( 'Primary hover background', 'booking' ),
549 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
550 'attr' => array(
551 'id' => 'booking_form_custom_button_hover_background_color',
552 ),
553 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
554 'row_hidden' => true,
555 'input_attrs' => array(
556 'pattern' => '^#[0-9A-Fa-f]{6}$',
557 ),
558 )
559 );
560
561 WPBC_BFB_Setting_Options::print_option(
562 array(
563 'type' => 'color',
564 'key' => 'booking_form_custom_button_hover_text_color',
565 'scope' => 'global',
566 'save_ui' => 'when_changed',
567 'autosave_on_form_save' => true,
568 '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',
569 'label' => __( 'Primary hover text', 'booking' ),
570 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
571 'attr' => array(
572 'id' => 'booking_form_custom_button_hover_text_color',
573 ),
574 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
575 'row_hidden' => true,
576 'input_attrs' => array(
577 'pattern' => '^#[0-9A-Fa-f]{6}$',
578 ),
579 )
580 );
581
582 WPBC_BFB_Setting_Options::print_option(
583 array(
584 'type' => 'color',
585 'key' => 'booking_form_custom_button_hover_border_color',
586 'scope' => 'global',
587 'save_ui' => 'when_changed',
588 'autosave_on_form_save' => true,
589 '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',
590 'label' => __( 'Primary hover border', 'booking' ),
591 'help' => __( 'Used when a submit or primary button is hovered, focused, or active.', 'booking' ),
592 'attr' => array(
593 'id' => 'booking_form_custom_button_hover_border_color',
594 ),
595 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
596 'row_hidden' => true,
597 'input_attrs' => array(
598 'pattern' => '^#[0-9A-Fa-f]{6}$',
599 ),
600 )
601 );
602
603 $secondary_button_color_options = array(
604 'booking_form_custom_secondary_button_background_color' => array( __( 'Secondary button background', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#fdfdfd' ),
605 'booking_form_custom_secondary_button_text_color' => array( __( 'Secondary button text', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#444444' ),
606 'booking_form_custom_secondary_button_border_color' => array( __( 'Secondary button border', 'booking' ), __( 'Used by Previous, Next, lightweight, and Stripe buttons.', 'booking' ), '#eeeeee' ),
607 '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' ),
608 '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' ),
609 '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' ),
610 );
611
612 foreach ( $secondary_button_color_options as $option_key => $option_data ) {
613 WPBC_BFB_Setting_Options::print_option(
614 array(
615 'type' => 'color',
616 'key' => $option_key,
617 'scope' => 'global',
618 'save_ui' => 'when_changed',
619 'autosave_on_form_save' => true,
620 'default' => isset( $wpbc_bfb_custom_style_values[ $option_key ] ) ? $wpbc_bfb_custom_style_values[ $option_key ] : $option_data[2],
621 'label' => $option_data[0],
622 'help' => $option_data[1],
623 'attr' => array(
624 'id' => $option_key,
625 ),
626 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
627 'row_hidden' => true,
628 'input_attrs' => array(
629 'pattern' => '^#[0-9A-Fa-f]{6}$',
630 ),
631 )
632 );
633 }
634
635 WPBC_BFB_Setting_Options::print_option(
636 array(
637 'type' => 'length',
638 'key' => 'booking_form_custom_button_border_width',
639 'scope' => 'global',
640 'save_ui' => 'when_changed',
641 'autosave_on_form_save' => true,
642 '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',
643 'label' => __( 'Button border width', 'booking' ),
644 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ),
645 'attr' => array(
646 'id' => 'booking_form_custom_button_border_width',
647 ),
648 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
649 'row_hidden' => true,
650 'length' => array(
651 'default_unit' => 'px',
652 'units' => array(
653 'px' => 'px',
654 'rem' => 'rem',
655 'em' => 'em',
656 ),
657 'bounds_map' => array(
658 'px' => array( 'min' => 0, 'max' => 20, 'step' => 1 ),
659 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
660 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
661 ),
662 ),
663 )
664 );
665
666 WPBC_BFB_Setting_Options::print_option(
667 array(
668 'type' => 'length',
669 'key' => 'booking_form_custom_button_border_radius',
670 'scope' => 'global',
671 'save_ui' => 'when_changed',
672 'autosave_on_form_save' => true,
673 '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',
674 'label' => __( 'Button corner radius', 'booking' ),
675 'help' => __( 'Used by primary and secondary buttons when Form style is Custom.', 'booking' ),
676 'attr' => array(
677 'id' => 'booking_form_custom_button_border_radius',
678 ),
679 'row_class' => 'wpbc_bfb__form_setting_global_custom_style',
680 'row_hidden' => true,
681 'length' => array(
682 'default_unit' => 'px',
683 'units' => array(
684 'px' => 'px',
685 'rem' => 'rem',
686 'em' => 'em',
687 ),
688 'bounds_map' => array(
689 'px' => array( 'min' => 0, 'max' => 40, 'step' => 1 ),
690 'rem' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
691 'em' => array( 'min' => 0, 'max' => 5, 'step' => 0.1 ),
692 ),
693 ),
694 )
695 );
696
697 ?>
698 <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;">
699 <div class="inspector__row" style="justify-content:flex-start;">
700 <div class="inspector__control" style="flex:1 1 auto;">
701 <button type="button" class="button button-secondary" data-wpbc-bfb-reset-custom-appearance="1" style="margin: 10px auto;display: block;">
702 <?php esc_html_e( 'Reset custom style', 'booking' ); ?>
703 </button>
704 <p class="wpbc_bfb__help" style="margin:6px 0 0 0;">
705 <?php esc_html_e( 'Restore the default custom container, spacing, field, and button colors. Save Form also saves these style changes.', 'booking' ); ?>
706 </p>
707 </div>
708 </div>
709 </div>
710 </div>
711 </section>
712 <?php
713
714 // ======================================================================
715 // == Group: Advanced
716 // ======================================================================
717
718 $panel_id_advanced = 'wpbc_bfb_form_settings_panel_advanced';
719 ?>
720 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-advanced">
721 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_advanced ); ?>">
722 <h3><?php esc_html_e( 'Advanced', 'booking' ); ?></h3>
723 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
724 </button>
725
726 <div class="group__fields" id="<?php echo esc_attr( $panel_id_advanced ); ?>" aria-hidden="true">
727 <?php
728
729 WPBC_BFB_Setting_Options::print_option(
730 array(
731 'type' => 'toggle',
732 'key' => 'booking_is_use_phone_validation',
733 'scope' => 'global',
734 'save_ui' => 'when_changed', // always | when_changed.
735 'default' => get_bk_option( 'booking_is_use_phone_validation', 'Off' ),
736 'label' => __( 'Smart phone validation', 'booking' ),
737 'help' => __( 'Validate phone number fields according to the user’s selected country format (e.g., +1 000 000 0000).', 'booking' ),
738 'attr' => array(
739 'id' => 'set_gen_booking_is_use_phone_validation',
740 ),
741 )
742 );
743
744 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
745 WPBC_BFB_Setting_Options::print_option(
746 array(
747 'type' => 'range',
748 'key' => 'booking_number_for_pre_checkin_date_hint',
749 'scope' => 'global',
750 'save_ui' => 'when_changed', // always | when_changed.
751 'default' => get_bk_option( 'booking_number_for_pre_checkin_date_hint', '14' ),
752 'label' => __( 'Pre-check-in display duration', 'booking' ),
753 'help' => __( 'Select the number of days used by the [pre_checkin_date_hint] shortcode (N days before the selected check-in date).', 'booking' ),
754 'attr' => array( 'id' => 'set_gen_booking_number_for_pre_checkin_date_hint' ),
755 'range' => array( 'min' => 1, 'max' => 91, 'step' => 1 ),
756 )
757 );
758 }
759
760 ?>
761 </div>
762 </section>
763 <?php
764
765 // ======================================================================
766 // == Group: Calendar
767 // ======================================================================
768
769 $panel_id_calendar = 'wpbc_bfb_form_settings_panel_calendar';
770 ?>
771 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-calendar">
772 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_calendar ); ?>">
773 <h3><?php esc_html_e( 'Custom Days Selection', 'booking' ); ?></h3>
774 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
775 </button>
776
777 <div class="group__fields" id="<?php
778 echo esc_attr( $panel_id_calendar ); ?>" aria-hidden="true">
779 <?php
780
781 // Days selection in calendar (LOCAL FORM SETTING).
782 WPBC_BFB_Setting_Options::print_option( array(
783 'type' => 'radio',
784 'key' => 'booking_type_of_day_selections',
785 'scope' => 'form',
786 'default' => '',
787 'label' => __( 'Days selection mode', 'booking' ),
788 'help' => __( 'Choose how visitors can select dates in this form’s calendar.', 'booking' ) . ' ' .
789 __( 'Default follows your global setting for the whole site.', 'booking' ) . ' ' .
790 __( 'Click Preview to see it in action.', 'booking' ),
791 'attr' => array(
792 'id' => 'booking_type_of_day_selections',
793 ),
794 'radio_layout' => 'inline',
795 'options' => array(
796 '' => __( 'Default', 'booking' ) . ' (' . __( 'calendar settings', 'booking' ) . ')',
797 'single' => __( 'Single day', 'booking' ),
798 'multiple' => __( 'Multiple days', 'booking' ),
799 'range' => __( 'Range days - 2 mouse clicks', 'booking' ),
800 ),
801 ) );
802
803 ?>
804 </div>
805 </section>
806 <?php
807
808
809 if(0){
810 // ======================================================================
811 // == Group: Debug
812 // ======================================================================
813
814 $panel_id_debug = 'wpbc_bfb_form_settings_panel_debug';
815 ?>
816 <section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="settings-debug">
817 <button type="button" class="group__header" role="button" aria-expanded="false" aria-controls="<?php echo esc_attr( $panel_id_debug ); ?>">
818 <h3><?php esc_html_e( 'Debug', 'booking' ); ?></h3>
819 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i>
820 </button>
821
822 <div class="group__fields" id="<?php echo esc_attr( $panel_id_debug ); ?>" aria-hidden="true">
823 <?php
824
825 // UI-only: no save_ui; state comes from JS/UI or defaults.
826 WPBC_BFB_Setting_Options::print_option(
827 array(
828 'type' => 'toggle',
829 'key' => 'booking_bfb_preview_mode',
830 'scope' => 'ui',
831 'default' => 'On',
832 'label' => __( 'Preview mode', 'booking' ),
833 'help' => __( 'Enable live preview rendering while building the form.', 'booking' ),
834 'attr' => array(
835 'id' => 'wpbc_bfb__toggle_preview',
836 ),
837 )
838 );
839
840 ?>
841 </div>
842 </section>
843 <?php
844 }
845
846 }
847