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

301 lines 11.4 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 // ======================================================================
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 }
301