| 1 |
<?php |
| 2 |
/** |
| 3 |
* Booking Form Builder – Admin Page. |
| 4 |
* |
| 5 |
* Responsibilities: |
| 6 |
* - Register tab & page placement. |
| 7 |
* - Capability & MU checks. |
| 8 |
* - Render page scaffolding (containers only). |
| 9 |
* - Enqueue assets and localize boot data. |
| 10 |
* |
| 11 |
* @package : Booking Calendar |
| 12 |
* @subpackage : Admin Pages |
| 13 |
* @Plugin_URI : https://wpbookingcalendar.com |
| 14 |
* @Author_URI : https://wpbookingcalendar.com |
| 15 |
* @Author : wpdevelop, oplugins |
| 16 |
* @Version : 0.0.1 |
| 17 |
* @since : 10.14.x |
| 18 |
* @modified : 2025-07-09 |
| 19 |
*/ |
| 20 |
|
| 21 |
// --------------------------------------------------------------------------------------------------------------------- |
| 22 |
// == File builder-form-page.php == Time point: 2025-08-29 12:25 |
| 23 |
// --------------------------------------------------------------------------------------------------------------------- |
| 24 |
if ( ! defined( 'ABSPATH' ) ) { |
| 25 |
exit; // Exit if accessed directly. |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
/** Show Content |
| 30 |
* Update Content |
| 31 |
* Define Slug |
| 32 |
* Define where to show |
| 33 |
*/ |
| 34 |
class WPBC_Page_Builder_Booking_Form extends WPBC_Page_Structure { |
| 35 |
|
| 36 |
// -- Tabs --------------------------------------------------------------------------------------------------------- |
| 37 |
|
| 38 |
/** |
| 39 |
* == What Page ? == |
| 40 |
* |
| 41 |
* @return string |
| 42 |
*/ |
| 43 |
public function in_page() { |
| 44 |
return 'wpbc-settings'; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* == Tabs == |
| 49 |
* |
| 50 |
* @return array |
| 51 |
*/ |
| 52 |
public function tabs() { |
| 53 |
|
| 54 |
$tabs = array(); |
| 55 |
$tabs['builder_booking_form'] = array( |
| 56 |
'is_default_full_screen' => true, // true | false. By default value is: false. |
| 57 |
'is_force_full_screen' => true, // true | false. Force full screen independently from user preference. |
| 58 |
'is_show_top_path' => true, // true | false. By default value is: true. |
| 59 |
'is_show_top_navigation' => false, // true | false. By default value is: false. |
| 60 |
'right_vertical_sidebar__is_show' => true, // true | false. By default value is: false. |
| 61 |
'right_vertical_sidebar__default_view_mode' => '', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 62 |
'right_vertical_sidebar_compact__is_show' => true, // true | false. By default value is: false. |
| 63 |
// 'left_navigation__default_view_mode' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 64 |
// 'left_navigation__force_view_mode' => 'compact', // '' | 'min' | 'compact' | 'max' | 'none'. Force sidebar mode independently from user preference. |
| 65 |
'left_navigation__default_view_mode' => 'max', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 66 |
'left_navigation__force_view_mode' => 'max', // '' | 'min' | 'compact' | 'max' | 'none'. Force sidebar mode independently from user preference. |
| 67 |
|
| 68 |
'top_path_title' => __( 'Forms Builder', 'booking' ), |
| 69 |
'title' => __( 'Forms Builder', 'booking' ), // Title of TAB. |
| 70 |
'hint' => '', //__( 'Define available and unavailable days for your calendar(s).', 'booking' ), // Hint. |
| 71 |
'page_title' => __( 'Forms Builder', 'booking' ), // Title of Page. |
| 72 |
'link' => '', // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link. |
| 73 |
'position' => '', // 'left' / 'right' / ''. |
| 74 |
'css_classes' => '', // CSS c l a s s(es). |
| 75 |
'icon' => '', // Icon - link to the real PNG img. |
| 76 |
'font_icon' => 'wpbc_icn_flip_x0 wpbc-bi-input-cursor-text 0layout-text-window-reverse', // 'wpbc_icn_free_cancellation' // CSS definition of forn Icon. |
| 77 |
'font_icon_right' => '', // 'wpbc-bi-asterisk', |
| 78 |
'default' => false, // Is this tab activated by default or not: true || false. |
| 79 |
'disabled' => false, // Is this tab disbaled: true || false. |
| 80 |
'hided' => false, // Is this tab hided: true || false. |
| 81 |
'subtabs' => array(), |
| 82 |
'folder_style' => 'order:12;', |
| 83 |
); |
| 84 |
return $tabs; |
| 85 |
} |
| 86 |
|
| 87 |
// -- Right Sidebar ----------------------------------------------------------------------------------------------- |
| 88 |
|
| 89 |
/** |
| 90 |
* == Right | Sidebar Compact | Content == |
| 91 |
* |
| 92 |
* @return void |
| 93 |
*/ |
| 94 |
public function right_sidebar_compact_content() { |
| 95 |
?> |
| 96 |
<div class="wpbc_bfb__rightbar_tabs" role="tablist" aria-label="<?php esc_attr_e( 'Form Builder Panels', 'booking' ); ?>"> |
| 97 |
<div class="wpbc_ui_el__level__folder"> |
| 98 |
<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item__builder_booking_form"> |
| 99 |
<button type="button" id="wpbc_tab_library" |
| 100 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 101 |
role="tab" aria-controls="wpbc_bfb__palette_add_new" aria-selected="true" > |
| 102 |
<i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x wpbc_icn_add_circle" aria-hidden="true" data-original-title="<?php esc_attr_e( 'Add New Fields', 'booking' ); ?>"></i> |
| 103 |
<span><?php esc_html_e( 'Add Fields', 'booking' ); ?></span> |
| 104 |
</button> |
| 105 |
</div> |
| 106 |
</div> |
| 107 |
<div class="wpbc_ui_el__level__folder"> |
| 108 |
<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item__builder_booking_form"> |
| 109 |
<button type="button" id="wpbc_tab_inspector" |
| 110 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 111 |
role="tab" aria-controls="wpbc_bfb__inspector" aria-selected="false" > |
| 112 |
<i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x wpbc-bi-input-cursor-text" aria-hidden="true" data-original-title="<?php esc_attr_e( 'Edit Field Options', 'booking' ); ?>"></i> |
| 113 |
<span><?php esc_html_e( 'Edit Field', 'booking' ); ?></span> |
| 114 |
</button> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
<div class="wpbc_ui_el__level__folder"> |
| 118 |
<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item__builder_booking_form"> |
| 119 |
<button type="button" id="wpbc_tab_formdetails" |
| 120 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 121 |
role="tab" aria-controls="wpbc_bfb__inspector_form_details" aria-selected="false" > |
| 122 |
<i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x 0wpbc_icn_widgets 0wpbc_icn_rotate_90 wpbc-bi-postcard" aria-hidden="true" data-original-title="<?php esc_attr_e( 'Details', 'booking' ); ?>"></i> |
| 123 |
<span><?php esc_html_e( 'Details', 'booking' ); ?></span> |
| 124 |
</button> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
<div class="wpbc_ui_el__level__folder"> |
| 128 |
<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item__builder_booking_form"> |
| 129 |
<button type="button" id="wpbc_tab_form" |
| 130 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 131 |
role="tab" aria-controls="wpbc_bfb__inspector_form_settings" aria-selected="false" > |
| 132 |
<i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x wpbc_icn_tune" aria-hidden="true" data-original-title="<?php esc_attr_e( 'Booking Form Settings', 'booking' ); ?>"></i> |
| 133 |
<span><?php esc_html_e( 'Settings', 'booking' ); ?></span> |
| 134 |
</button> |
| 135 |
</div> |
| 136 |
</div> |
| 137 |
<?php // FixIn: 10.15.5.5. ?> |
| 138 |
<!-- Code Tools — default hidden --> |
| 139 |
<div class="wpbc_ui_el__level__folder wpbc_bfb__rightbar_tab_wrap wpbc_bfb__rightbar_tab_wrap--advanced_tools" hidden> |
| 140 |
<div class="wpbc_ui_el__vert_nav_item wpbc_ui_el__vert_nav_item__builder_booking_form"> |
| 141 |
<button type="button" id="wpbc_tab_advanced_tools" |
| 142 |
class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__single" |
| 143 |
role="tab" |
| 144 |
aria-controls="wpbc_bfb__inspector_advanced_tools" |
| 145 |
aria-selected="false"> |
| 146 |
<i class="wpbc_ui_el__vert_nav_icon tooltip_right_offset menu_icon icon-1x wpbc_icn_code_off wpbc_icn_rotate_180" |
| 147 |
aria-hidden="true" |
| 148 |
data-original-title="<?php esc_attr_e( 'Help and generator for Advanced Mode', 'booking' ); ?>"></i> |
| 149 |
<span><?php esc_html_e( 'Shortcodes', 'booking' ); ?></span> |
| 150 |
</button> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
</div> |
| 154 |
<?php |
| 155 |
} |
| 156 |
|
| 157 |
/** |
| 158 |
* == Right Sidebar Content == |
| 159 |
* |
| 160 |
* @return void |
| 161 |
*/ |
| 162 |
public function right_sidebar_content() { |
| 163 |
?> |
| 164 |
<!-- RIGHT SIDE: Panels container --> |
| 165 |
<div class="wpbc_bfb__panel--library"> |
| 166 |
<!-- Add Fields (Library) — default visible --> |
| 167 |
<div id="wpbc_bfb__palette_add_new" |
| 168 |
class="wpbc_bfb__palette_add_new wpbc_bfb__palette_panel wpbc_collapsible wpbc_collapsible--exclusive" |
| 169 |
role="tabpanel" |
| 170 |
aria-labelledby="wpbc_tab_library" |
| 171 |
aria-hidden="false"> |
| 172 |
<?php |
| 173 |
$this->palette_add_new__content(); |
| 174 |
?> |
| 175 |
</div> |
| 176 |
|
| 177 |
<!-- Edit Field (Inspector) — default hidden --> |
| 178 |
<div id="wpbc_bfb__inspector" |
| 179 |
class="wpbc_bfb__inspector wpbc_bfb__palette_panel wpbc_collapsible wpbc_collapsible--exclusive" |
| 180 |
role="tabpanel" |
| 181 |
aria-labelledby="wpbc_tab_inspector" |
| 182 |
hidden |
| 183 |
aria-hidden="true"> |
| 184 |
<div class="wpbc_bfb__inspector__body"> |
| 185 |
<div class="wpbc_bfb__inspector__empty"> |
| 186 |
<?php |
| 187 |
esc_html_e( 'Select a field to edit its options.', 'booking' ); |
| 188 |
?> |
| 189 |
</div> |
| 190 |
</div> |
| 191 |
</div> |
| 192 |
|
| 193 |
<!-- Settings Options — default hidden --> |
| 194 |
<div id="wpbc_bfb__inspector_form_settings" |
| 195 |
class="wpbc_bfb__inspector_form_settings wpbc_bfb__palette_panel wpbc_collapsible wpbc_collapsible--exclusive" |
| 196 |
role="tabpanel" |
| 197 |
aria-labelledby="wpbc_tab_form" |
| 198 |
hidden |
| 199 |
aria-hidden="true"> |
| 200 |
<div class="wpbc_bfb__inspector__head"> |
| 201 |
<div class="header_container"> |
| 202 |
<div class="header_title_content"> |
| 203 |
<h3 class="title"><?php esc_html_e( 'Global Form Settings', 'booking' ); ?></h3> |
| 204 |
<div class="desc"><?php esc_html_e( 'Setup settings for entire form. These settings usually aplies globally to all forms.', 'booking' ); ?></div> |
| 205 |
</div> |
| 206 |
</div> |
| 207 |
</div> |
| 208 |
<div class="wpbc_bfb__inspector__body"> |
| 209 |
<?php |
| 210 |
wpbc_bfb_ui__settings_options__print(); |
| 211 |
?> |
| 212 |
</div> |
| 213 |
</div> |
| 214 |
|
| 215 |
<!-- Settings Options — default hidden --> |
| 216 |
<div id="wpbc_bfb__inspector_form_details" |
| 217 |
class="wpbc_bfb__inspector_form_details wpbc_bfb__palette_panel wpbc_collapsible wpbc_collapsible--exclusive" |
| 218 |
role="tabpanel" |
| 219 |
aria-labelledby="wpbc_tab_formdetails" |
| 220 |
hidden |
| 221 |
aria-hidden="true"> |
| 222 |
<div class="wpbc_bfb__inspector__head"> |
| 223 |
<div class="header_container"> |
| 224 |
<div class="header_title_content"> |
| 225 |
<h3 class="title"><?php esc_html_e( 'Form Details', 'booking' ); ?></h3> |
| 226 |
<div class="desc"><?php esc_html_e( 'These details are saved together with the form when you click “Save Form”.', 'booking' ); ?></div> |
| 227 |
</div> |
| 228 |
</div> |
| 229 |
</div> |
| 230 |
<div class="wpbc_bfb__inspector__body"> |
| 231 |
<?php |
| 232 |
wpbc_bfb_ui__current_form_details__print(); |
| 233 |
?> |
| 234 |
</div> |
| 235 |
</div> |
| 236 |
|
| 237 |
<?php // FixIn: 10.15.5.5. ?> |
| 238 |
<!-- Advanced Mode Tools — default hidden --> |
| 239 |
<div id="wpbc_bfb__inspector_advanced_tools" |
| 240 |
class="wpbc_bfb__inspector_advanced_tools wpbc_bfb__palette_panel wpbc_collapsible wpbc_collapsible--exclusive" |
| 241 |
role="tabpanel" |
| 242 |
aria-labelledby="wpbc_tab_advanced_tools" |
| 243 |
hidden |
| 244 |
aria-hidden="true"> |
| 245 |
<div class="wpbc_bfb__inspector__head"> |
| 246 |
<div class="header_container"> |
| 247 |
<div class="header_title_content"> |
| 248 |
<h3 class="title"><?php esc_html_e( 'Advanced Mode Tools', 'booking' ); ?></h3> |
| 249 |
<div class="desc"><?php esc_html_e( 'Generate booking form code, review examples, and get help while working in Advanced Mode.', 'booking' ); ?></div> |
| 250 |
</div> |
| 251 |
</div> |
| 252 |
</div> |
| 253 |
|
| 254 |
<div class="wpbc_bfb__inspector__body"> |
| 255 |
|
| 256 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-booking_essentials"> |
| 257 |
<button type="button" class="group__header"> |
| 258 |
<h3><?php esc_html_e( 'Booking Essentials', 'booking' ); ?></h3> |
| 259 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 260 |
</button> |
| 261 |
<div class="group__fields"> |
| 262 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__booking_essentials' ); ?> |
| 263 |
</div> |
| 264 |
</section> |
| 265 |
|
| 266 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="advanced-mode-fields"> |
| 267 |
<button type="button" class="group__header"> |
| 268 |
<h3><?php esc_html_e( 'Fields', 'booking' ); ?></h3> |
| 269 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 270 |
</button> |
| 271 |
<div class="group__fields"> |
| 272 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__fields' ); ?> |
| 273 |
</div> |
| 274 |
</section> |
| 275 |
|
| 276 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-time_services"> |
| 277 |
<button type="button" class="group__header"> |
| 278 |
<h3><?php esc_html_e( 'Time & Services', 'booking' ); ?></h3> |
| 279 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 280 |
</button> |
| 281 |
<div class="group__fields"> |
| 282 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__time_services' ); ?> |
| 283 |
</div> |
| 284 |
</section> |
| 285 |
|
| 286 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-layouts"> |
| 287 |
<button type="button" class="group__header"> |
| 288 |
<h3><?php esc_html_e( 'Layouts', 'booking' ); ?></h3> |
| 289 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 290 |
</button> |
| 291 |
<div class="group__fields"> |
| 292 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__layouts' ); ?> |
| 293 |
</div> |
| 294 |
</section> |
| 295 |
|
| 296 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-hints"> |
| 297 |
<button type="button" class="group__header"> |
| 298 |
<h3><?php esc_html_e( 'Hints', 'booking' ); ?></h3> |
| 299 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 300 |
</button> |
| 301 |
<div class="group__fields"> |
| 302 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__hints' ); ?> |
| 303 |
</div> |
| 304 |
</section> |
| 305 |
|
| 306 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-conditional_rules"> |
| 307 |
<button type="button" class="group__header"> |
| 308 |
<h3><?php esc_html_e( 'Conditional Rules', 'booking' ); ?></h3> |
| 309 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 310 |
</button> |
| 311 |
<div class="group__fields"> |
| 312 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__conditional_rules' ); ?> |
| 313 |
</div> |
| 314 |
</section> |
| 315 |
|
| 316 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-simple_html_layout"> |
| 317 |
<button type="button" class="group__header"> |
| 318 |
<h3><?php esc_html_e( 'Simple HTML Layout', 'booking' ); ?></h3> |
| 319 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 320 |
</button> |
| 321 |
<div class="group__fields"> |
| 322 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__simple_html_layout' ); ?> |
| 323 |
</div> |
| 324 |
</section> |
| 325 |
|
| 326 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-tips_and_tricks"> |
| 327 |
<button type="button" class="group__header"> |
| 328 |
<h3><?php esc_html_e( 'Tips and Tricks', 'booking' ); ?></h3> |
| 329 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 330 |
</button> |
| 331 |
<div class="group__fields"> |
| 332 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__tips_and_tricks' ); ?> |
| 333 |
</div> |
| 334 |
</section> |
| 335 |
|
| 336 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="advanced-mode-other_fields"> |
| 337 |
<button type="button" class="group__header"> |
| 338 |
<h3><?php esc_html_e( 'Other Fields', 'booking' ); ?></h3> |
| 339 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 340 |
</button> |
| 341 |
<div class="group__fields"> |
| 342 |
<?php do_action( 'wpbc_bfb_advanced_mode_sidebar__other_fields' ); ?> |
| 343 |
</div> |
| 344 |
</section> |
| 345 |
|
| 346 |
</div> |
| 347 |
</div> |
| 348 |
|
| 349 |
</div> |
| 350 |
<?php |
| 351 |
} |
| 352 |
|
| 353 |
/** |
| 354 |
* "Add New Fields" - "Palette" - Right Side. |
| 355 |
* |
| 356 |
* @return void |
| 357 |
*/ |
| 358 |
private function palette_add_new__content() { |
| 359 |
?> |
| 360 |
<div class="wpbc_bfb__inspector__body"> |
| 361 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group is-open" data-group="fields-essentials"> |
| 362 |
<button type="button" class="group__header"><h3><?php esc_html_e( 'Booking Essentials', 'booking' ); ?></h3><i |
| 363 |
class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 364 |
</button> |
| 365 |
<div class="group__fields"> |
| 366 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 367 |
<?php |
| 368 |
/** Let packs target "general" if they want */ |
| 369 |
do_action( 'wpbc_bfb_palette_register_items', 'essentials', 'top' ); |
| 370 |
do_action( 'wpbc_bfb_palette_register_items', 'essentials', 'bottom' ); |
| 371 |
?> |
| 372 |
</ul> |
| 373 |
</div> |
| 374 |
</section> |
| 375 |
|
| 376 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-standard"> |
| 377 |
<button type="button" class="group__header"><h3><?php esc_html_e( 'Fields', 'booking' ); ?></h3><i |
| 378 |
class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 379 |
</button> |
| 380 |
<div class="group__fields"> |
| 381 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 382 |
<?php |
| 383 |
/** Let packs target "general" if they want */ |
| 384 |
do_action( 'wpbc_bfb_palette_register_items', 'standard', 'top' ); |
| 385 |
do_action( 'wpbc_bfb_palette_register_items', 'standard', 'bottom' ); |
| 386 |
?> |
| 387 |
</ul> |
| 388 |
</div> |
| 389 |
</section> |
| 390 |
|
| 391 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-times"> |
| 392 |
<button type="button" class="group__header"><h3><?php esc_html_e( 'Time & Services', 'booking' ); ?></h3><i |
| 393 |
class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 394 |
</button> |
| 395 |
<div class="group__fields"> |
| 396 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 397 |
<?php |
| 398 |
/** Let packs target "general" if they want */ |
| 399 |
do_action( 'wpbc_bfb_palette_register_items', 'times', 'top' ); |
| 400 |
do_action( 'wpbc_bfb_palette_register_items', 'times', 'bottom' ); |
| 401 |
?> |
| 402 |
</ul> |
| 403 |
</div> |
| 404 |
</section> |
| 405 |
|
| 406 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-layout"> |
| 407 |
<button type="button" class="group__header"><h3><?php esc_html_e( 'Layout', 'booking' ); ?></h3><i |
| 408 |
class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 409 |
</button> |
| 410 |
<div class="group__fields"> |
| 411 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 412 |
<?php |
| 413 |
/** Let packs target "structure" if they want */ |
| 414 |
do_action( 'wpbc_bfb_palette_register_items', 'layout', 'top' ); |
| 415 |
do_action( 'wpbc_bfb_palette_register_items', 'layout', 'bottom' ); |
| 416 |
?> |
| 417 |
</ul> |
| 418 |
</div> |
| 419 |
</section> |
| 420 |
|
| 421 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-navigation"> |
| 422 |
<button type="button" class="group__header"><h3><?php esc_html_e( 'Multi-Step & Navigation', 'booking' ); ?></h3><i |
| 423 |
class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 424 |
</button> |
| 425 |
<div class="group__fields"> |
| 426 |
|
| 427 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 428 |
<?php |
| 429 |
/** Let packs target "advanced" if they want */ |
| 430 |
do_action( 'wpbc_bfb_palette_register_items', 'navigation', 'top' ); |
| 431 |
do_action( 'wpbc_bfb_palette_register_items', 'navigation', 'bottom' ); |
| 432 |
?> |
| 433 |
</ul> |
| 434 |
|
| 435 |
</div> |
| 436 |
</section> |
| 437 |
|
| 438 |
|
| 439 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-hints_dates"> |
| 440 |
<button type="button" class="group__header"> |
| 441 |
<h3><?php |
| 442 |
esc_html_e( 'Date & Time Hints', 'booking' ); ?></h3> |
| 443 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 444 |
</button> |
| 445 |
<div class="group__fields"> |
| 446 |
|
| 447 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 448 |
<?php |
| 449 |
do_action( 'wpbc_bfb_palette_register_items', 'hints_dates', 'top' ); |
| 450 |
do_action( 'wpbc_bfb_palette_register_items', 'hints_dates', 'bottom' ); |
| 451 |
?> |
| 452 |
</ul> |
| 453 |
|
| 454 |
</div> |
| 455 |
</section> |
| 456 |
|
| 457 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-hints"> |
| 458 |
<button type="button" class="group__header"> |
| 459 |
<h3><?php |
| 460 |
esc_html_e( 'Cost Hints', 'booking' ); ?></h3> |
| 461 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 462 |
</button> |
| 463 |
<div class="group__fields"> |
| 464 |
|
| 465 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 466 |
<?php |
| 467 |
do_action( 'wpbc_bfb_palette_register_items', 'hints', 'top' ); |
| 468 |
do_action( 'wpbc_bfb_palette_register_items', 'hints', 'bottom' ); |
| 469 |
?> |
| 470 |
</ul> |
| 471 |
|
| 472 |
</div> |
| 473 |
</section> |
| 474 |
|
| 475 |
<section class="wpbc_bfb__inspector__group wpbc_ui__collapsible_group" data-group="fields-hints_other"> |
| 476 |
<button type="button" class="group__header"> |
| 477 |
<h3><?php |
| 478 |
esc_html_e( 'Booking Info Hints', 'booking' ); ?></h3> |
| 479 |
<i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i> |
| 480 |
</button> |
| 481 |
<div class="group__fields"> |
| 482 |
|
| 483 |
<ul class="wpbc_bfb__panel_field_types__ul"> |
| 484 |
<?php |
| 485 |
do_action( 'wpbc_bfb_palette_register_items', 'hints_other', 'top' ); |
| 486 |
do_action( 'wpbc_bfb_palette_register_items', 'hints_other', 'bottom' ); |
| 487 |
?> |
| 488 |
</ul> |
| 489 |
|
| 490 |
</div> |
| 491 |
</section> |
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
</div> |
| 496 |
<?php |
| 497 |
} |
| 498 |
|
| 499 |
// -- Content ------------------------------------------------------------------------------------------------------ |
| 500 |
|
| 501 |
/** |
| 502 |
* == Page Content == |
| 503 |
* |
| 504 |
* @return false|void |
| 505 |
*/ |
| 506 |
public function content() { |
| 507 |
|
| 508 |
do_action( 'wpbc_hook_settings_page_header', 'page_booking_builder_booking_form' ); // Define Notices Section and show some static messages, if needed. |
| 509 |
|
| 510 |
if ( ! wpbc_is_mu_user_can_be_here( 'activated_user' ) ) { return false; } // Check if MU user activated, otherwise show Warning message. |
| 511 |
// if ( ! wpbc_set_default_resource_to__get() ) return false; // Define default booking resources for $_GET and check if booking resource belong to user. |
| 512 |
wpbc_js_for_bookings_page(); // JavaScript functions. |
| 513 |
|
| 514 |
wpbc_bfb__adavanced_mode__enqueue_code_editor_for_advanced_tab(); |
| 515 |
|
| 516 |
wpbc_bfb__ui__show_warning__no_mobile_mode(); |
| 517 |
|
| 518 |
echo '<div id="wpbc_log_screen" class="wpbc_log_screen"></div>'; |
| 519 |
|
| 520 |
wpbc_bfb__ui__add_columns_control(); |
| 521 |
|
| 522 |
// == Expose AJAX settings to JS on the Builder page == |
| 523 |
wpbc_bfb_output_ajax_boot_config(); |
| 524 |
|
| 525 |
// == Top Horizontal menu == |
| 526 |
$tabs_config = array( |
| 527 |
'builder_tab' => array( |
| 528 |
'title' => __( 'Form Builder', 'booking' ) . ' (Visual)', |
| 529 |
'type' => 'panel', |
| 530 |
'css_classes' => '', |
| 531 |
'data_attr' => array( |
| 532 |
'data-wpbc-bfb-top-builder-btn' => '1', |
| 533 |
), |
| 534 |
), |
| 535 |
'advanced_tab' => array( |
| 536 |
'title' => __( 'Advanced Mode', 'booking' ) . ' (Code)', |
| 537 |
'type' => 'panel', |
| 538 |
'css_classes' => '', |
| 539 |
'data_attr' => array( |
| 540 |
'data-wpbc-bfb-top-advanced-btn' => '1', |
| 541 |
), |
| 542 |
), |
| 543 |
); |
| 544 |
$tabs_config['debug_tab'] = array( |
| 545 |
'title' => __( 'Debug', 'booking' ), |
| 546 |
'type' => 'panel', |
| 547 |
'css_classes' => 'align_right small_debug_tab', |
| 548 |
'hint' => array( |
| 549 |
'title' => __( 'Show debug export outputs', 'booking' ), |
| 550 |
'position' => 'top', |
| 551 |
), |
| 552 |
); |
| 553 |
|
| 554 |
$tabs_config = apply_filters( 'wpbc_bfb_ui__top_tabs', $tabs_config, array() ); |
| 555 |
|
| 556 |
$preferred_tab_id = 'builder_tab'; //TODO: make selection based on "bfb_options":{"advanced_mode_source":"builder"} |
| 557 |
$active_tab_id = WPBC_BFB_UI_Top_Tabs::resolve_active_tab_id( $tabs_config, $preferred_tab_id ); |
| 558 |
|
| 559 |
WPBC_BFB_UI_Top_Tabs::render( |
| 560 |
array( |
| 561 |
'active_tab' => $active_tab_id, |
| 562 |
'tabs' => $tabs_config, |
| 563 |
'nav_container_id' => 'wpbc_bfb__top_horisontal_nav', |
| 564 |
'panels_root_id' => 'wpbc_bfb__top_panels', |
| 565 |
'panel_base_class' => 'wpbc_bfb__top_tab_section', |
| 566 |
) |
| 567 |
); |
| 568 |
|
| 569 |
|
| 570 |
// == Content == |
| 571 |
?> |
| 572 |
<div id="wpbc_bfb__top_panels"> |
| 573 |
<!-- BFB Content. --> |
| 574 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__builder_tab wpbc_bfb__top_tab_section wpbc_bfb__top_tab_section__builder_tab" <?php echo WPBC_BFB_UI_Top_Tabs::get_panel_hidden_attr( 'builder_tab', $active_tab_id );/* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>> |
| 575 |
<div class="wpbc_bfb__container"> |
| 576 |
<!-- LEFT SIDE: Pages --> |
| 577 |
<div id="wpbc_bfb__theme_scope" class="wpbc_bfb__theme_scope"> |
| 578 |
<div id="wpbc_bfb__pages_panel" class="wpbc_bfb__pages_panel"> |
| 579 |
<!-- Events binded to this element! --> |
| 580 |
<div id="wpbc_bfb__pages_container"> |
| 581 |
<!-- This is loader spin --> |
| 582 |
<div class="wpbc_bfb__panel wpbc_bfb__panel--preview wpbc_bfb_form wpbc_container wpbc_form wpbc_container_booking_form"> |
| 583 |
<div class="wpbc_bfb__form_preview_section_container wpbc_wizard__border_container" style="margin: 20px 0;box-sizing: border-box;width: auto;min-height: Min(50vh, 300px);display: flex;flex-flow: column nowrap;justify-content: center;" > |
| 584 |
<?php wpbc_bfb_spins_loading_container_mini(); ?> |
| 585 |
</div> |
| 586 |
</div> |
| 587 |
</div> |
| 588 |
<div style="display:flex;margin:20px;flex-flow: row wrap;align-items: center;justify-content: center;"> |
| 589 |
<button class="button button-primary wpbc_ui_button wpbc_bs_button_green" id="wpbc_bfb__add_page_btn" aria-label="<?php esc_attr_e( 'Add Page', 'booking' ); ?>">+ <?php esc_html_e( 'Add Page', 'booking' ); ?></button> |
| 590 |
</div> |
| 591 |
</div> |
| 592 |
</div> |
| 593 |
</div> |
| 594 |
</div> |
| 595 |
<!-- Advanced Mode Content tab --> |
| 596 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__advanced_tab wpbc_bfb__top_tab_section wpbc_bfb__top_tab_section__advanced_tab" |
| 597 |
<?php echo WPBC_BFB_UI_Top_Tabs::get_panel_hidden_attr( 'advanced_tab', $active_tab_id ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?> |
| 598 |
><?php |
| 599 |
|
| 600 |
//-------------------------------------------------------------------------------------------------------------- |
| 601 |
// 'Upgrade to Pro' widget |
| 602 |
//-------------------------------------------------------------------------------------------------------------- |
| 603 |
$upgrade_content_arr = wpbc_get_upgrade_widget( |
| 604 |
array( |
| 605 |
'id' => 'widget_wpbc_dismiss__booking_form_advanced_mode', |
| 606 |
'dismiss_css_class' => '.wpbc_dismiss__booking_form_advanced_mode', |
| 607 |
'blured_in_versions' => array( 'free' ), |
| 608 |
'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ), |
| 609 |
'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ), |
| 610 |
'versions' => 'paid versions', |
| 611 |
'css' => 'transform: translate(0) translateY(290px);', |
| 612 |
'no_dismiss' => true |
| 613 |
) |
| 614 |
); |
| 615 |
echo $upgrade_content_arr['content']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 616 |
|
| 617 |
?><div class="<?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>"><?php |
| 618 |
|
| 619 |
wpbc_bfb__adavanced_mode__render_advanced_form_editor_panel(); |
| 620 |
|
| 621 |
?></div><?php |
| 622 |
|
| 623 |
?> |
| 624 |
</div> |
| 625 |
<!-- Debug Mode tab --> |
| 626 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__debug_tab wpbc_bfb__top_tab_section wpbc_bfb__top_tab_section__debug_tab" |
| 627 |
<?php echo WPBC_BFB_UI_Top_Tabs::get_panel_hidden_attr( 'debug_tab', $active_tab_id ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>> |
| 628 |
|
| 629 |
<div id="wpbc_bfb__debug_export_panel" class="wpbc_bfb__debug_export_panel" aria-hidden="false"> |
| 630 |
<!-- JS (builder-exporter.js) will inject three debug textareas here --> |
| 631 |
|
| 632 |
<!-- Tabs --> |
| 633 |
<?php |
| 634 |
|
| 635 |
$tabs_config_debug = array( |
| 636 |
'debug_mode__export' => array( |
| 637 |
'title' => __( 'Export', 'booking' ), |
| 638 |
'type' => 'panel', |
| 639 |
'css_classes' => '', |
| 640 |
), |
| 641 |
'debug_mode__import' => array( |
| 642 |
'title' => __( 'Import', 'booking' ), |
| 643 |
'type' => 'panel', |
| 644 |
'css_classes' => '', |
| 645 |
), |
| 646 |
'debug_mode__actual_bfb' => array( |
| 647 |
'title' => __( 'Actual Builder Code', 'booking' ), |
| 648 |
'type' => 'panel', |
| 649 |
'css_classes' => '', |
| 650 |
), |
| 651 |
); |
| 652 |
|
| 653 |
WPBC_BFB_UI_Top_Tabs::render( |
| 654 |
array( |
| 655 |
'active_tab' => 'debug_mode__export', |
| 656 |
'tabs' => $tabs_config_debug, |
| 657 |
'nav_container_id' => 'wpbc_bfb__top_horisontal__debug_mode', |
| 658 |
'panels_root_id' => 'wpbc_bfb__debug_mode_panels', |
| 659 |
) |
| 660 |
); |
| 661 |
|
| 662 |
?> |
| 663 |
<div id="wpbc_bfb__debug_mode_panels"> |
| 664 |
|
| 665 |
|
| 666 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__debug_mode__export"> |
| 667 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--structure" style="margin-top: 14px;"> |
| 668 |
<h4><?php |
| 669 |
esc_html_e( 'Form Structure', 'booking' ); echo ' — '; esc_html_e( 'Export', 'booking' ); echo ' (JSON)'; ?></h4> |
| 670 |
<textarea id="wpbc_bfb__structure_output" readonly="readonly"></textarea> |
| 671 |
<div style="margin-top: 8px;"> |
| 672 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__structure_output"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 673 |
</div> |
| 674 |
</div> |
| 675 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--settings" style="margin-top: 14px;"> |
| 676 |
<h4><?php esc_html_e( 'Form Settings', 'booking' ); echo ' — '; esc_html_e( 'Export', 'booking' ); echo ' (JSON)'; ?></h4> |
| 677 |
<textarea id="wpbc_bfb__settings_output" readonly="readonly"></textarea> |
| 678 |
<div style="margin-top: 8px;"> |
| 679 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__settings_output"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 680 |
</div> |
| 681 |
</div> |
| 682 |
<div style="flex:1 1 100%;"></div> |
| 683 |
<button type="button" class="button wpbc_bfb__debug_separate_button" |
| 684 |
onclick="var structure = window.wpbc_bfb && window.wpbc_bfb.get_structure ? window.wpbc_bfb.get_structure() : null; console.log(JSON.stringify(structure, null, 2));"> |
| 685 |
<?php esc_html_e( 'Print JSON Structure in Browser Console', 'booking' ); ?> |
| 686 |
</button> |
| 687 |
</div> |
| 688 |
|
| 689 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__debug_mode__import"> |
| 690 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--structure-import" style="margin-top: 14px;"> |
| 691 |
<h4><?php esc_html_e( 'Form Structure', 'booking' ); echo ' — '; esc_html_e( 'Import', 'booking' ); echo ' (JSON)'; ?></h4> |
| 692 |
<textarea id="wpbc_bfb__structure_import" ></textarea> |
| 693 |
<div style="margin-top: 8px;"> |
| 694 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__structure_import"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 695 |
<button type="button" class="button button-primary" data-wpbc-bfb-debug-action="apply_structure"><?php esc_html_e( 'Apply Structure', 'booking' ); ?></button> |
| 696 |
</div> |
| 697 |
</div> |
| 698 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--settings-import" style="margin-top: 14px;"> |
| 699 |
<h4><?php esc_html_e( 'Form Settings', 'booking' ); echo ' — '; esc_html_e( 'Import', 'booking' ); echo ' (JSON)'; ?></h4> |
| 700 |
<textarea id="wpbc_bfb__settings_import" ></textarea> |
| 701 |
<div style="margin-top: 8px;"> |
| 702 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__settings_import"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 703 |
<button type="button" class="button button-primary" data-wpbc-bfb-debug-action="apply_settings"><?php esc_html_e( 'Apply Settings', 'booking' ); ?></button> |
| 704 |
</div> |
| 705 |
</div> |
| 706 |
<div style="flex:1 1 100%;"></div> |
| 707 |
<button type="button" class="button wpbc_bfb__debug_separate_button" data-wpbc-bfb-debug-action="apply_both"><?php esc_html_e( 'Apply Both', 'booking' ); ?></button> |
| 708 |
</div> |
| 709 |
|
| 710 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__debug_mode__actual_bfb"> |
| 711 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--advanced" style="margin-top: 14px;"> |
| 712 |
<h4><?php esc_html_e( 'Advanced Form', 'booking' ); echo ' — '; esc_html_e( 'Export', 'booking' ); echo ' (CODE)'; ?></h4> |
| 713 |
<textarea id="wpbc_bfb__advanced_form_output"readonly="readonly"></textarea> |
| 714 |
<div style="margin-top: 8px;"> |
| 715 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__advanced_form_output"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 716 |
</div> |
| 717 |
</div> |
| 718 |
<div class="wpbc_bfb__debug_block wpbc_bfb__debug_block--content" style="margin-top: 14px;"> |
| 719 |
<h4><?php esc_html_e( 'Content of booking fields data', 'booking' ); echo ' — '; esc_html_e( 'Export', 'booking' ); echo ' (CODE)'; ?></h4> |
| 720 |
<textarea id="wpbc_bfb__content_form_output"readonly="readonly"></textarea> |
| 721 |
<div style="margin-top: 8px;"> |
| 722 |
<button type="button" class="button" data-wpbc-bfb-debug-action="copy" data-wpbc-bfb-debug-target="wpbc_bfb__content_form_output"><?php esc_html_e( 'Copy to Clipboard', 'booking' ); ?></button> |
| 723 |
</div> |
| 724 |
</div> |
| 725 |
</div> |
| 726 |
|
| 727 |
</div> |
| 728 |
|
| 729 |
</div> |
| 730 |
</div> |
| 731 |
|
| 732 |
<!-- Preview Section Content tab --> |
| 733 |
<div class="wpbc_bfb__tab_section wpbc_bfb__tab_section__preview_tab wpbc_bfb__top_tab_section wpbc_bfb__top_tab_section__preview_tab" |
| 734 |
<?php echo WPBC_BFB_UI_Top_Tabs::get_panel_hidden_attr( 'preview_tab', $active_tab_id ); /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped */ ?>> |
| 735 |
<?php wpbc_bfb_render_preview_panel(); ?> |
| 736 |
</div> |
| 737 |
</div> |
| 738 |
<?php |
| 739 |
|
| 740 |
// == Hidden Templates for - Booking Actions == |
| 741 |
do_action( 'wpbc_hook_bfb_template__hidden_templates' ); |
| 742 |
|
| 743 |
do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking_builder_booking_form' ); |
| 744 |
} |
| 745 |
} |
| 746 |
|
| 747 |
add_action( 'wpbc_menu_created', array( new WPBC_Page_Builder_Booking_Form(), '__construct' ) ); // Executed after creation of Menu. |
| 748 |
|
| 749 |
|
| 750 |
// == One-way redirect from removed legacy form settings =============================================================== |
| 751 |
|
| 752 |
/** |
| 753 |
* Disable showing removed legacy "WP Booking Calendar > Settings > Booking Form" page. |
| 754 |
* |
| 755 |
* @param bool $is_show - 'usually' - true. |
| 756 |
* @param string $page_tag - can be 'wpbc-settings'. |
| 757 |
* @param string $active_page_tab - can be 'form'. |
| 758 |
* @param string $active_page_subtab - can be 'booking_form_fields'. |
| 759 |
* |
| 760 |
* @return false|mixed |
| 761 |
*/ |
| 762 |
function wpbc_form_fields__check__showing_page( $is_show, $page_tag, $active_page_tab, $active_page_subtab ) { |
| 763 |
|
| 764 |
if ( ( 'form' === $active_page_tab ) && ( 'wpbc-settings' === $page_tag ) ) { |
| 765 |
$is_show = false; |
| 766 |
} |
| 767 |
|
| 768 |
return $is_show; |
| 769 |
} |
| 770 |
// Important here to have priority 20 instead of 10, because it can be ovveriden by same hook in MU, where we check 'check_for_active_users'. |
| 771 |
add_filter( 'wpbc_before_showing_settings_page_is_show_page', 'wpbc_form_fields__check__showing_page', 20, 4 ); |
| 772 |
|
| 773 |
|
| 774 |
/** |
| 775 |
* Unset removed legacy Form menu in vertical left menu widget. |
| 776 |
* |
| 777 |
* @param array $nav_tabs - array of menus. |
| 778 |
* @param string $this_page - current selected page. |
| 779 |
* |
| 780 |
* @return mixed |
| 781 |
*/ |
| 782 |
function wpbc_form_fields__check__plugin_menu_structure( $nav_tabs, $this_page ) { |
| 783 |
|
| 784 |
if ( isset( $nav_tabs['wpbc-settings'] ) && isset( $nav_tabs['wpbc-settings']['form'] ) ) { |
| 785 |
unset( $nav_tabs['wpbc-settings']['form'] ); |
| 786 |
} |
| 787 |
|
| 788 |
return $nav_tabs; |
| 789 |
} |
| 790 |
add_filter( 'wpbc_plugin_menu_structure_arr', 'wpbc_form_fields__check__plugin_menu_structure', 20, 2 ); |
| 791 |
|
| 792 |
|
| 793 |
/** Trick here to overload default REQUST parameters before page is loading */ |
| 794 |
function wpbc_form_fields__check__define_page_redirect( $page_tag ) { |
| 795 |
|
| 796 |
// $page_tag - here can be all defined in plugin menu pages. So we need to check activated page. By default its inside of $_GET['page']. |
| 797 |
// Execute it only for WP Booking Calendar > Settings > Booking Form > Booking Form Fields page. |
| 798 |
|
| 799 |
if ( wpbc_is_settings_form_page() ) { |
| 800 |
// phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect |
| 801 |
wp_redirect( admin_url( "admin.php?page=wpbc-settings&tab=builder_booking_form" ) ); |
| 802 |
} |
| 803 |
} |
| 804 |
// We are set 9 to execute earlier than hook in WPBC_Admin_Menus. |
| 805 |
add_action( 'wpbc_define_nav_tabs', 'wpbc_form_fields__check__define_page_redirect', 9 ); // This Hook fire in the class WPBC_Admin_Menus for showing page content of specific menu |
| 806 |
|