| @@ -29,13 +29,21 @@ | ||
| 29 | 29 | ), |
| 30 | 30 | 'wpbc-divider-1' => array( |
| 31 | 31 | 'type' => 'divider', |
| 32 | 32 | ), |
| 33 | - 'wpbc-availability' => array( | |
| 33 | + ); | |
| 34 | + | |
| 35 | + $pages_arr['wpbc-resources'] = array( | |
| 36 | + 'type' => 'menu', | |
| 37 | + 'title' => __( 'Resources', 'booking' ), | |
| 38 | + 'font_icon' => 'wpbc-bi-list', | |
| 39 | + ); | |
| 40 | + | |
| 41 | + | |
| 42 | + $pages_arr['wpbc-availability'] = array( | |
| 34 | 43 | 'type' => 'menu', |
| 35 | 44 | 'title' => __( 'Availability', 'booking' ), |
| 36 | 45 | 'font_icon' => 'wpbc-bi-calendar-week', |
| 37 | - ), | |
| 38 | 46 | ); |
| 39 | 47 | |
| 40 | 48 | if ( class_exists('wpdev_bk_biz_m') ) { |
| 41 | 49 | $pages_arr['wpbc-prices'] = array( |
| @@ -44,21 +52,9 @@ | ||
| 44 | 52 | 'font_icon' => 'wpbc-bi-cash-stack', |
| 45 | 53 | ); |
| 46 | 54 | } |
| 47 | 55 | |
| 48 | - if ( class_exists('wpdev_bk_personal') ) { | |
| 49 | - $pages_arr['wpbc-resources'] = array( | |
| 50 | - 'type' => 'menu', | |
| 51 | - 'title' => __( 'Resources', 'booking' ) . ' / ' . __( 'unique calendars', 'booking' ), | |
| 52 | - 'font_icon' => 'wpbc-bi-list', | |
| 53 | - ); | |
| 54 | - } else { | |
| 55 | - $pages_arr['wpbc-resources'] = array( | |
| 56 | - 'type' => 'menu', | |
| 57 | - 'title' => __( 'Resource', 'booking' ) . ' / ' . __( 'Publish', 'booking' ), | |
| 58 | - 'font_icon' => 'wpbc-bi-list', | |
| 59 | - ); | |
| 60 | - } | |
| 56 | + | |
| 61 | 57 | $pages_arr['wpbc-divider-2'] = array( |
| 62 | 58 | 'type' => 'divider', |
| 63 | 59 | ); |
| 64 | 60 | $pages_arr['wpbc-settings'] = array( |
| @@ -84,9 +80,9 @@ | ||
| 84 | 80 | ); |
| 85 | 81 | $params = wp_parse_args( $args, $defaults ); |
| 86 | 82 | |
| 87 | 83 | // Ability to click on panel, only if there 'min' class - panel minimized! |
| 88 | - echo '<div class="wpbc_ui_el__vert_left_bar__wrapper" onclick0="javascript:if (( jQuery( this ).parent(\'.wpbc_settings_page_wrapper\').hasClass(\'min\') ) && ( ! wpbc_admin_ui__is_in_mobile_screen_size())) { wpbc_admin_ui__sidebar_left__do_max(); }" >'; | |
| 84 | + echo '<div class="wpbc_ui_el__vert_left_bar__wrapper" onclick="javascript:if (( jQuery( this ).parent(\'.wpbc_settings_page_wrapper\').hasClass(\'min\') ) && ( ! wpbc_admin_ui__is_in_mobile_screen_size())) { wpbc_admin_ui__sidebar_left__do_max( true ); }" >'; | |
| 89 | 85 | |
| 90 | 86 | // FixIn: 10.12.1.7. |
| 91 | 87 | wpbc_ui__vert_left_bar__side_button__do_compact(); |
| 92 | 88 | wpbc_ui__vert_left_bar__side_button__do_max(); |
| @@ -96,11 +92,33 @@ | ||
| 96 | 92 | 'active_tab' => $args ['active_tab'], // calendar_appearance. |
| 97 | 93 | 'active_subtab' => $args['active_subtab'], // calendar_appearance_skin. |
| 98 | 94 | ); |
| 99 | 95 | |
| 96 | + if ( function_exists( 'wpbc_booking_modes_v3_compile_sidebar_navigation' ) ) { | |
| 97 | + $args['page_nav_tabs'] = wpbc_booking_modes_v3_compile_sidebar_navigation( $args['page_nav_tabs'] ); | |
| 98 | + } | |
| 99 | + | |
| 100 | 100 | // Available Main Menu - slug => titles. |
| 101 | 101 | $root_menu_arr = wpbc_ui__get_root_menu_arr(); |
| 102 | 102 | |
| 103 | + if ( function_exists( 'wpbc_booking_modes_v3_compile_root_navigation' ) ) { | |
| 104 | + $root_menu_arr = wpbc_booking_modes_v3_compile_root_navigation( $root_menu_arr, $args['page_nav_tabs'] ); | |
| 105 | + } | |
| 106 | + | |
| 107 | + // A mode may display an existing controller route below a different presentation group. | |
| 108 | + foreach ( $args['page_nav_tabs'] as $presentation_page_slug => $presentation_tabs ) { | |
| 109 | + if ( ! is_array( $presentation_tabs ) ) { | |
| 110 | + continue; | |
| 111 | + } | |
| 112 | + | |
| 113 | + foreach ( $presentation_tabs as $presentation_tab ) { | |
| 114 | + if ( is_array( $presentation_tab ) && ! empty( $presentation_tab['is_active'] ) ) { | |
| 115 | + $active_page_arr['active_page'] = $presentation_page_slug; | |
| 116 | + break 2; | |
| 117 | + } | |
| 118 | + } | |
| 119 | + } | |
| 120 | + | |
| 103 | 121 | echo ' <div class="wpbc_ui_el__vert_left_bar__content">'; |
| 104 | 122 | |
| 105 | 123 | $is_show_all_menus = true; |
| 106 | 124 | |
| @@ -109,10 +127,11 @@ | ||
| 109 | 127 | } else { |
| 110 | 128 | |
| 111 | 129 | // wpbc_ui_el__divider_horizontal(); |
| 112 | 130 | echo '<div class="wpbc_ui_el__row100 wpbc_ui_el__expand_colapse_btns">'; |
| 113 | - wpbc_ui__vert_left_bar__do_compact(); | |
| 114 | - wpbc_ui__vert_left_bar__do_max(); | |
| 131 | + wpbc_ui__vert_left_bar__do_min(); | |
| 132 | + //wpbc_ui__vert_left_bar__do_compact(); | |
| 133 | + //wpbc_ui__vert_left_bar__do_max(); | |
| 115 | 134 | echo '</div>'; |
| 116 | 135 | |
| 117 | 136 | echo ' <div class="wpbc_ui_el__vert_left_bar__root_sections_container" role="tablist">'; |
| 118 | 137 | } |
| @@ -124,14 +143,32 @@ | ||
| 124 | 143 | continue; |
| 125 | 144 | } |
| 126 | 145 | |
| 127 | 146 | $page_title = $root_menu_options_arr['title']; |
| 128 | - $is_expanded = ( $main_page_slug === $active_page_arr['active_page'] ); | |
| 147 | + $is_v3_standalone = ! empty( $root_menu_options_arr['mode_standalone'] ); | |
| 148 | + // Respect a V3 root's explicit initial state while retaining the original Settings behavior for V1. | |
| 149 | + if ( $is_v3_standalone ) { | |
| 150 | + $is_expanded = true; | |
| 151 | + } elseif ( isset( $root_menu_options_arr['mode_expanded'] ) ) { | |
| 152 | + $is_expanded = 'On' === $root_menu_options_arr['mode_expanded'] | |
| 153 | + || ( 'when_active' === $root_menu_options_arr['mode_expanded'] && $main_page_slug === $active_page_arr['active_page'] ); | |
| 154 | + } else { | |
| 155 | + $is_expanded = ( 'wpbc-settings' !== $main_page_slug ) || ( $main_page_slug === $active_page_arr['active_page'] ); | |
| 156 | + } | |
| 129 | 157 | |
| 130 | 158 | if ( $is_show_all_menus ) { |
| 131 | 159 | echo ' <div class="wpbc_ui_el__vert_left_bar__root_section_element root_section_element_' . esc_attr( $main_page_slug ) . ' ' . ( ( $is_expanded ) ? 'section_expanded' : '' ) . '">'; |
| 132 | 160 | |
| 133 | - wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title ); | |
| 161 | + $mode_font_icon = isset( $root_menu_options_arr['mode_font_icon'] ) ? $root_menu_options_arr['mode_font_icon'] : ''; | |
| 162 | + if ( ! $is_v3_standalone ) { | |
| 163 | + wpbc_ui__vert_menu__show_root_section_header( | |
| 164 | + $main_page_slug, | |
| 165 | + $page_title, | |
| 166 | + $mode_font_icon, | |
| 167 | + isset( $root_menu_options_arr['mode_expanded'] ), | |
| 168 | + $is_expanded | |
| 169 | + ); | |
| 170 | + } | |
| 134 | 171 | } |
| 135 | 172 | |
| 136 | 173 | echo ' <div class="wpbc_ui_el__vert_left_bar__section wpbc_ui_el__vert_left_bar__section_' . |
| 137 | 174 | esc_attr( $main_page_slug ) . |
| @@ -155,63 +192,74 @@ | ||
| 155 | 192 | echo '</div>'; |
| 156 | 193 | wpbc_ui_el__divider_horizontal(); |
| 157 | 194 | } |
| 158 | 195 | |
| 159 | - foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) { | |
| 196 | + if ( function_exists( 'wpbc_booking_modes_v3_compile_sidebar_navigation' ) ) { | |
| 197 | + wpbc_ui__vert_menu__render_v3_nodes( $page_item_arr ); | |
| 198 | + } else { | |
| 199 | + foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) { | |
| 200 | + $folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : ''; | |
| 160 | 201 | |
| 161 | - $folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : ''; | |
| 202 | + $folder_css = ''; | |
| 203 | + $is_folder_expanded = ! empty( $menu_item_arr['subtabs'] ) && ! empty( $menu_item_arr['is_active'] ); | |
| 204 | + if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) { | |
| 205 | + $is_folder_expanded = 'On' === $menu_item_arr['_wpbc_v3_expanded'] | |
| 206 | + || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && $is_folder_expanded ); | |
| 207 | + } | |
| 208 | + if ( $is_folder_expanded ) { | |
| 209 | + $folder_css .= ' expanded'; | |
| 210 | + } | |
| 211 | + if ( ! empty( $menu_item_arr['_wpbc_v3_branch_css_classes'] ) ) { | |
| 212 | + $folder_css .= ' ' . $menu_item_arr['_wpbc_v3_branch_css_classes']; | |
| 213 | + } | |
| 162 | 214 | |
| 163 | - $folder_css = ''; | |
| 164 | - if ( ( ! empty( $menu_item_arr['subtabs'] ) ) && ( ! empty( $menu_item_arr['is_active'] ) ) ) { | |
| 165 | - $folder_css .= ' expanded'; | |
| 166 | - } | |
| 215 | + echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">'; | |
| 167 | 216 | |
| 168 | - echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">'; | |
| 169 | 217 | |
| 218 | + if ( empty( $menu_item_arr['type'] ) ) { | |
| 219 | + $menu_item_arr['type'] = 'main'; | |
| 220 | + } | |
| 170 | 221 | |
| 171 | - if ( empty( $menu_item_arr['type'] ) ) { | |
| 172 | - $menu_item_arr['type'] = 'main'; | |
| 173 | - } | |
| 222 | + switch ( $menu_item_arr['type'] ) { | |
| 174 | 223 | |
| 175 | - switch ( $menu_item_arr['type'] ) { | |
| 224 | + case 'separator': | |
| 225 | + wpbc_ui_el__divider_horizontal(); | |
| 226 | + break; | |
| 176 | 227 | |
| 177 | - case 'separator': | |
| 178 | - wpbc_ui_el__divider_horizontal(); | |
| 179 | - break; | |
| 228 | + case 'html': | |
| 229 | + wpbc_ui__vert_menu__item_html( $main_menu_slug, $menu_item_arr ); | |
| 230 | + break; | |
| 180 | 231 | |
| 181 | - case 'html': | |
| 182 | - wpbc_ui__vert_menu__item_html( $main_menu_slug, $menu_item_arr ); | |
| 183 | - break; | |
| 232 | + default: | |
| 233 | + wpbc_ui__vert_menu__item_main( $main_menu_slug, $menu_item_arr ); | |
| 234 | + } | |
| 184 | 235 | |
| 185 | - default: | |
| 186 | - wpbc_ui__vert_menu__item_main( $main_menu_slug, $menu_item_arr ); | |
| 187 | - } | |
| 188 | 236 | |
| 237 | + foreach ( $menu_item_arr['subtabs'] as $main_submenu_slug => $submenu_item_arr ) { | |
| 189 | 238 | |
| 190 | - foreach ( $menu_item_arr['subtabs'] as $main_submenu_slug => $submenu_item_arr ) { | |
| 239 | + if ( empty( $submenu_item_arr['type'] ) ) { | |
| 240 | + $submenu_item_arr['type'] = 'subtab'; | |
| 241 | + } | |
| 191 | 242 | |
| 192 | - if ( empty( $submenu_item_arr['type'] ) ) { | |
| 193 | - $submenu_item_arr['type'] = 'subtab'; | |
| 194 | - } | |
| 243 | + switch ( $submenu_item_arr['type'] ) { | |
| 195 | 244 | |
| 196 | - switch ( $submenu_item_arr['type'] ) { | |
| 245 | + case 'subtab': | |
| 246 | + wpbc_ui__vert_menu__item_sub( $main_submenu_slug, $submenu_item_arr ); | |
| 247 | + break; | |
| 197 | 248 | |
| 198 | - case 'subtab': | |
| 199 | - wpbc_ui__vert_menu__item_sub( $main_submenu_slug, $submenu_item_arr ); | |
| 200 | - break; | |
| 249 | + case 'separator': | |
| 250 | + wpbc_ui__vert_menu__item_separtor( $main_submenu_slug, $submenu_item_arr ); | |
| 251 | + break; | |
| 201 | 252 | |
| 202 | - case 'separator': | |
| 203 | - wpbc_ui__vert_menu__item_separtor( $main_submenu_slug, $submenu_item_arr ); | |
| 204 | - break; | |
| 253 | + case 'html': | |
| 254 | + wpbc_ui__vert_menu__item_html( $main_submenu_slug, $submenu_item_arr ); | |
| 255 | + break; | |
| 205 | 256 | |
| 206 | - case 'html': | |
| 207 | - wpbc_ui__vert_menu__item_html( $main_submenu_slug, $submenu_item_arr ); | |
| 208 | - break; | |
| 209 | - | |
| 210 | - default: | |
| 257 | + default: | |
| 258 | + } | |
| 211 | 259 | } |
| 260 | + echo '</div><!-- wpbc_ui_el__level__folder -->'; | |
| 212 | 261 | } |
| 213 | - echo '</div><!-- wpbc_ui_el__level__folder -->'; | |
| 214 | 262 | } |
| 215 | 263 | |
| 216 | 264 | if ( $is_show_all_menus ) { |
| 217 | 265 | echo ' </div><!-- wpbc_ui_el__vert_left_bar__root_section_element -->'; |
| @@ -224,11 +272,9 @@ | ||
| 224 | 272 | echo ' </div><!-- wpbc_ui_el__vert_left_bar__root_sections_container -->'; |
| 225 | 273 | } |
| 226 | 274 | |
| 227 | 275 | |
| 228 | - $is_show_up = wpbc_is_show_up(); | |
| 229 | - // Show upgrade icon only for the Free version here. | |
| 230 | - $is_show_up = ( $is_show_up && ( ! class_exists( 'wpdev_bk_personal' ) ) ); | |
| 276 | + $is_show_up = wpbc_is_show_free_upgrade(); | |
| 231 | 277 | if ( $is_show_up ) { |
| 232 | 278 | ?><div class="wpbc_ui_el__vert_left_bar__footer_compensator"></div><?php |
| 233 | 279 | } |
| 234 | 280 | |
| @@ -235,9 +281,9 @@ | ||
| 235 | 281 | echo ' </div><!-- wpbc_ui_el__vert_left_bar__content -->'; |
| 236 | 282 | if ( $is_show_up ) { |
| 237 | 283 | $url = wpbc_up_link(); |
| 238 | 284 | ?> |
| 239 | - <div class="wpbc_ui_el__vert_left_bar__footer_section"> | |
| 285 | + <div class="wpbc_ui_el__vert_left_bar__footer_section" style="visibility: hidden;"> | |
| 240 | 286 | <a class="wpbc_ui_el_upgrade_button wpbc_button_light wpbc_button_green" href="<?php echo esc_url( $url ); ?>"> |
| 241 | 287 | <span class="hide_in_compact_mode"><?php esc_html_e( 'Upgrade to Pro', 'booking' ); ?></span> |
| 242 | 288 | <span class="hide_in_max_mode"><?php esc_html_e( 'Pro', 'booking' ); ?></span> |
| 243 | 289 | </a> |
| @@ -249,8 +295,80 @@ | ||
| 249 | 295 | wpbc_start_element_scrollable__with_simplebar( '.wpbc_ui_el__vert_left_bar__content' ); |
| 250 | 296 | } |
| 251 | 297 | |
| 252 | 298 | /** |
| 299 | + * Render an arbitrarily nested V3 sidebar through the existing row functions. | |
| 300 | + * | |
| 301 | + * Top-level and disclosure nodes retain the existing main-row markup. Nested | |
| 302 | + * leaves retain the existing subrow markup, so the recursive traversal adds no | |
| 303 | + * new visual system or navigation-only asset. | |
| 304 | + * | |
| 305 | + * @param array $navigation_nodes Prepared V3 navigation nodes. | |
| 306 | + * @param int $depth Zero-based sidebar depth. | |
| 307 | + * | |
| 308 | + * @return void | |
| 309 | + */ | |
| 310 | +function wpbc_ui__vert_menu__render_v3_nodes( $navigation_nodes, $depth = 0 ) { | |
| 311 | + foreach ( $navigation_nodes as $menu_slug => $menu_item_arr ) { | |
| 312 | + if ( ! is_array( $menu_item_arr ) ) { | |
| 313 | + continue; | |
| 314 | + } | |
| 315 | + | |
| 316 | + $subtabs = isset( $menu_item_arr['subtabs'] ) && is_array( $menu_item_arr['subtabs'] ) ? $menu_item_arr['subtabs'] : array(); | |
| 317 | + $has_children = ! empty( $subtabs ); | |
| 318 | + $item_type = empty( $menu_item_arr['type'] ) ? ( 0 === $depth || $has_children ? 'main' : 'subtab' ) : $menu_item_arr['type']; | |
| 319 | + | |
| 320 | + if ( 0 < $depth && ! $has_children ) { | |
| 321 | + switch ( $item_type ) { | |
| 322 | + case 'separator': | |
| 323 | + wpbc_ui__vert_menu__item_separtor( $menu_slug, $menu_item_arr ); | |
| 324 | + break; | |
| 325 | + | |
| 326 | + case 'html': | |
| 327 | + wpbc_ui__vert_menu__item_html( $menu_slug, $menu_item_arr ); | |
| 328 | + break; | |
| 329 | + | |
| 330 | + default: | |
| 331 | + wpbc_ui__vert_menu__item_sub( $menu_slug, $menu_item_arr ); | |
| 332 | + } | |
| 333 | + continue; | |
| 334 | + } | |
| 335 | + | |
| 336 | + $folder_style = ! empty( $menu_item_arr['folder_style'] ) ? $menu_item_arr['folder_style'] : ''; | |
| 337 | + $folder_css = ''; | |
| 338 | + $is_expanded = $has_children && ! empty( $menu_item_arr['is_active'] ); | |
| 339 | + if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) { | |
| 340 | + $is_expanded = 'On' === $menu_item_arr['_wpbc_v3_expanded'] | |
| 341 | + || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && $is_expanded ); | |
| 342 | + } | |
| 343 | + if ( $is_expanded ) { | |
| 344 | + $folder_css .= ' expanded'; | |
| 345 | + } | |
| 346 | + if ( ! empty( $menu_item_arr['_wpbc_v3_branch_css_classes'] ) ) { | |
| 347 | + $folder_css .= ' ' . $menu_item_arr['_wpbc_v3_branch_css_classes']; | |
| 348 | + } | |
| 349 | + | |
| 350 | + echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">'; | |
| 351 | + switch ( $item_type ) { | |
| 352 | + case 'separator': | |
| 353 | + wpbc_ui_el__divider_horizontal(); | |
| 354 | + break; | |
| 355 | + | |
| 356 | + case 'html': | |
| 357 | + wpbc_ui__vert_menu__item_html( $menu_slug, $menu_item_arr ); | |
| 358 | + break; | |
| 359 | + | |
| 360 | + default: | |
| 361 | + wpbc_ui__vert_menu__item_main( $menu_slug, $menu_item_arr ); | |
| 362 | + } | |
| 363 | + if ( $has_children ) { | |
| 364 | + wpbc_ui__vert_menu__render_v3_nodes( $subtabs, $depth + 1 ); | |
| 365 | + } | |
| 366 | + echo '</div><!-- wpbc_ui_el__level__folder -->'; | |
| 367 | + } | |
| 368 | +} | |
| 369 | + | |
| 370 | +/** | |
| 253 | 371 | * Set Scrolable Element with Simplebar js library. |
| 254 | 372 | * |
| 255 | 373 | * @param string $jq_element - e.g. '.wpbc_ui_el__vert_left_bar__content' |
| 256 | 374 | * @param string $options - e.g. 'autoHide: false, scrollbarMinSize: 10' - options for the Simplebar. See more: https://www.npmjs.com/package/simplebar#1-documentation |
| @@ -266,9 +384,15 @@ | ||
| 266 | 384 | <script type="text/javascript"> |
| 267 | 385 | (function() { var a = setInterval( function() { if ( ( 'undefined' === typeof jQuery ) || ! window.jQuery ) { return; } clearInterval( a ); jQuery( document ).ready( function () { |
| 268 | 386 | jQuery( '.wpbc_ui_el__vert_left_bar__section' ).css( { "animation-duration": "1ms" } ); // Set animation of showing left siebar from left to right imediate to prevent flipping. |
| 269 | 387 | if ( 'undefined' !== typeof SimpleBar ) { |
| 270 | - new SimpleBar( jQuery( '<?php echo esc_attr( $jq_element ); ?>' )[0], { <?php echo esc_attr( $options ); ?> } ); | |
| 388 | + var simplebar_element = jQuery( '<?php echo esc_attr( $jq_element ); ?>' )[0]; | |
| 389 | + if ( simplebar_element ) { | |
| 390 | + var simplebar_instance = new SimpleBar( simplebar_element, { <?php echo esc_attr( $options ); ?> } ); | |
| 391 | + if ( 'function' === typeof wpbc_admin_ui__sidebar_left__scroll_to_active_item ) { | |
| 392 | + wpbc_admin_ui__sidebar_left__scroll_to_active_item( simplebar_instance ); | |
| 393 | + } | |
| 394 | + } | |
| 271 | 395 | } |
| 272 | 396 | var wait_timer = setTimeout( function (){ |
| 273 | 397 | jQuery( '.wpbc_ui_el__vert_left_bar__section' ).css( { "animation-duration": "200ms" } ); // Set animation to normal value. |
| 274 | 398 | }, 300 ); |
| @@ -286,13 +410,15 @@ | ||
| 286 | 410 | */ |
| 287 | 411 | function wpbc_ui__vert_left_bar__do_toggle() { |
| 288 | 412 | |
| 289 | 413 | $el_arr = array(); |
| 290 | - $el_arr['font_icon'] = 'wpbc_icn_menu'; | |
| 414 | + $el_arr['font_icon'] = 'wpbc-bi-layout-sidebar-inset'; // 'wpbc_icn_menu'; | |
| 291 | 415 | $el_arr['container_style'] = 'padding:0 8px;'; |
| 292 | 416 | $el_arr['container_class'] = 'wpbc_ui__top_nav__btn_show_left_vertical_nav'; |
| 293 | - $el_arr['onclick'] = "if ( jQuery( '.wpbc_ui_el__vert_left_bar__content' ).is( ':visible' ) ) {"; | |
| 294 | - $el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_min( true ); '; | |
| 417 | + $el_arr['onclick'] = "if ( jQuery( '.wpbc_page_wrapper_left_max' ).length ) {"; | |
| 418 | + // $el_arr['onclick'] = "if ( jQuery( '.wpbc_ui_el__vert_left_bar__content' ).is( ':visible' ) ) {"; | |
| 419 | + // $el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_min( true ); '; | |
| 420 | + $el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_compact( true ); '; | |
| 295 | 421 | $el_arr['onclick'] .= '} else {'; |
| 296 | 422 | $el_arr['onclick'] .= ' wpbc_admin_ui__sidebar_left__do_max( true ); '; |
| 297 | 423 | $el_arr['onclick'] .= '}'; |
| 298 | 424 | $el_arr['hint'] = array( |
| @@ -367,14 +493,17 @@ | ||
| 367 | 493 | function wpbc_ui__vert_left_bar__do_min() { |
| 368 | 494 | |
| 369 | 495 | $el_arr = array(); |
| 370 | 496 | $el_arr['container_style'] = ''; |
| 371 | - $el_arr['container_class'] = 'wpbc_ui__top_nav__btn_hide_left_vertical_nav'; | |
| 372 | - $el_arr['onclick'] = ' wpbc_admin_ui__sidebar_left__do_min( true ); '; | |
| 373 | - $el_arr['font_icon'] = 'wpbc_icn_minimize'; | |
| 497 | + $el_arr['container_class'] = '';// 'wpbc_ui__top_nav__btn_hide_left_vertical_nav'; | |
| 498 | + // User Save Preferences of other pages (saved collapsed left menu). | |
| 499 | + // $el_arr['onclick'] = 'event.stopPropagation(); wpbc_admin_ui__sidebar_left__do_min( true ); '; | |
| 500 | + // Do NOT - Save User Preferences of other pages (not save collapsed left menu). | |
| 501 | + $el_arr['onclick'] = 'event.stopPropagation(); wpbc_admin_ui__sidebar_left__do_min(); '; | |
| 502 | + $el_arr['font_icon'] = 'wpbc_icn_close'; //'wpbc_icn_minimize'; | |
| 374 | 503 | $el_arr['hint'] = array( |
| 375 | - 'title' => __( 'Minimize side menu', 'booking' ), | |
| 376 | - 'position' => 'bottom', | |
| 504 | + 'title' => __( 'Hide', 'booking' ), | |
| 505 | + 'position' => 'right', | |
| 377 | 506 | ); |
| 378 | 507 | wpbc_ui_el__a( $el_arr ); |
| 379 | 508 | } |
| 380 | 509 | |
| @@ -458,24 +587,38 @@ | ||
| 458 | 587 | |
| 459 | 588 | /** |
| 460 | 589 | * Show Root Header |
| 461 | 590 | * |
| 462 | - * @param string $main_page_slug - slug of all sub menu section. | |
| 463 | - * @param string $page_title - title of header. | |
| 464 | - * @param bool $is_expanded - Is expanded or not. | |
| 591 | + * @param string $main_page_slug Slug of the submenu section. | |
| 592 | + * @param string $page_title Section title. | |
| 593 | + * @param string $font_icon Optional sanitized font-icon CSS classes supplied by the selected mode. | |
| 594 | + * @param bool $is_v3_scoped Whether to use V3's nearest-branch disclosure behavior. | |
| 595 | + * @param bool $is_expanded Whether the V3 branch is initially expanded. | |
| 465 | 596 | * |
| 466 | 597 | * @return void |
| 467 | 598 | */ |
| 468 | -function wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title) { | |
| 599 | +function wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title, $font_icon = '', $is_v3_scoped = false, $is_expanded = false ) { | |
| 469 | 600 | |
| 470 | 601 | $css_section = '.root_section_element_' . $main_page_slug; |
| 471 | 602 | |
| 472 | 603 | // Section Header. |
| 473 | - ?><a class="wpbc_ui_el__row100 wpbc_ui_el__root_section_header_a" href="javascript:void(0)" | |
| 474 | - onclick="javascript:var is_has_class = jQuery( '<?php echo esc_attr( $css_section ); ?>' ).hasClass('section_expanded'); jQuery( '.wpbc_ui_el__vert_left_bar__root_section_element' ).removeClass('section_expanded'); if (is_has_class) { jQuery( '<?php echo esc_attr( $css_section ); ?>' ).removeClass('section_expanded'); } else {jQuery( '<?php echo esc_attr( $css_section ); ?>' ).addClass('section_expanded');}" | |
| 475 | - ><?php | |
| 604 | + ?><a class="wpbc_ui_el__row100 wpbc_ui_el__root_section_header_a" | |
| 605 | + href="javascript:void(0)" | |
| 606 | + <?php if ( $is_v3_scoped ) { ?> | |
| 607 | + aria-expanded="<?php echo $is_expanded ? 'true' : 'false'; ?>" | |
| 608 | + onkeydown="if ( ' ' === event.key ) { event.preventDefault(); this.click(); }" | |
| 609 | + onclick="javascript:var wpbc_root=jQuery(this).closest('.wpbc_ui_el__vert_left_bar__root_section_element');var wpbc_open=wpbc_root.hasClass('section_expanded');wpbc_root.toggleClass('section_expanded',!wpbc_open);jQuery(this).attr('aria-expanded',wpbc_open?'false':'true');" | |
| 610 | + <?php } else { ?> | |
| 611 | + onclick="javascript:var is_has_class = jQuery( '<?php echo esc_attr( $css_section ); ?>' ).hasClass('section_expanded'); <?php | |
| 612 | + /* ?> jQuery( '.wpbc_ui_el__vert_left_bar__root_section_element' ).removeClass('section_expanded'); <?php */ | |
| 613 | + ?>if (is_has_class) { jQuery( '<?php echo esc_attr( $css_section ); ?>' ).removeClass('section_expanded'); } else {jQuery( '<?php echo esc_attr( $css_section ); ?>' ).addClass('section_expanded');}" | |
| 614 | + <?php } ?> | |
| 615 | + > | |
| 616 | + <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i><?php | |
| 476 | 617 | |
| 477 | - ?><i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i><?php | |
| 618 | + if ( '' !== $font_icon ) { | |
| 619 | + ?><i class="wpbc_ui_el__vert_menu_root_section_font_icon menu_icon icon-1x <?php echo esc_attr( $font_icon ); ?>" aria-hidden="true"></i><?php | |
| 620 | + } | |
| 478 | 621 | |
| 479 | 622 | wpbc_ui__vert_menu__show_section_header( $page_title ); |
| 480 | 623 | |
| 481 | 624 | ?></a><?php |
| @@ -558,9 +701,15 @@ | ||
| 558 | 701 | if ( ! empty( $menu_item_arr['subtabs'] ) ) { |
| 559 | 702 | // Folder Item - expand / colapse. Previously: here was : wpbc_admin_ui__sidebar_left__do_max(); |
| 560 | 703 | ?> |
| 561 | 704 | <a href="javascript:void(0)" |
| 562 | - onclick="javascript: if( ! jQuery( this ).parents('.wpbc_ui_el__level__folder').hasClass('expanded') ) { jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');jQuery( this ).parents('.wpbc_ui_el__level__folder').addClass('expanded'); } else {jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');} " | |
| 705 | + <?php if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) { ?> | |
| 706 | + aria-expanded="<?php echo ( 'On' === $menu_item_arr['_wpbc_v3_expanded'] || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && ! empty( $menu_item_arr['is_active'] ) ) ) ? 'true' : 'false'; ?>" | |
| 707 | + onkeydown="if ( ' ' === event.key ) { event.preventDefault(); this.click(); }" | |
| 708 | + onclick="javascript:var wpbc_folder=jQuery(this).closest('.wpbc_ui_el__level__folder');var wpbc_open=wpbc_folder.hasClass('expanded');wpbc_folder.toggleClass('expanded',!wpbc_open);jQuery(this).attr('aria-expanded',wpbc_open?'false':'true');" | |
| 709 | + <?php } else { ?> | |
| 710 | + onclick="javascript: if( ! jQuery( this ).parents('.wpbc_ui_el__level__folder').hasClass('expanded') ) { jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');jQuery( this ).parents('.wpbc_ui_el__level__folder').addClass('expanded'); } else {jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');} " | |
| 711 | + <?php } ?> | |
| 563 | 712 | class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__folder"> |
| 564 | 713 | <?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?> |
| 565 | 714 | <?php // Show icon in max mode, without right tooltip, thanks to '.hide_in_compact_mode'. // FixIn: 10.11.5.8. ?> |
| 566 | 715 | <i class="wpbc_ui_el__vert_nav_icon hide_in_compact_mode menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>" |
| @@ -750,10 +899,15 @@ | ||
| 750 | 899 | */ |
| 751 | 900 | function wpbc_ui__vert_left_bar__side_button__do_compact() { |
| 752 | 901 | |
| 753 | 902 | ?> |
| 754 | - <button class="wpbc_ui__left_sidebar__side_button wpbc_ui__top_nav__btn_hide_left_vertical_nav" | |
| 755 | - onclick="javascript:wpbc_admin_ui__sidebar_left__do_min( true );" title="<?php esc_attr_e( 'Minimize side menu', 'booking' ); ?>"> | |
| 903 | + <button type="button" class="wpbc_ui__left_sidebar__side_button wpbc_ui__top_nav__btn_hide_left_vertical_nav" | |
| 904 | + <?php /* Save user preferences ?> | |
| 905 | + onclick="event.stopPropagation(); wpbc_admin_ui__sidebar_left__do_min( true ); return false;" | |
| 906 | + <?php /**/ ?> | |
| 907 | + <?php /* Not Save user preferences - collpased left menu */ ?> | |
| 908 | + onclick="event.stopPropagation(); wpbc_admin_ui__sidebar_left__do_min(); return false;" | |
| 909 | + title="<?php esc_attr_e( 'Minimize side menu', 'booking' ); ?>"> | |
| 756 | 910 | <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> |
| 757 | 911 | <path fill="#6B6B6B" d="M16.5 22a1.003 1.003 0 0 1-.71-.29l-9-9a1 1 0 0 1 0-1.42l9-9a1.004 1.004 0 1 1 1.42 1.42L8.91 12l8.3 8.29A.999.999 0 0 1 16.5 22Z"></path> |
| 758 | 912 | </svg> |
| 759 | 913 | </button> |
| @@ -766,10 +920,10 @@ | ||
| 766 | 920 | * @return void |
| 767 | 921 | */ |
| 768 | 922 | function wpbc_ui__vert_left_bar__side_button__do_max() { |
| 769 | 923 | ?> |
| 770 | - <button class="wpbc_ui__left_sidebar__side_button wpbc_ui__hide wpbc_ui__top_nav__btn_open_left_vertical_nav" | |
| 771 | - onclick="javascript:wpbc_admin_ui__sidebar_left__do_max( true );" title="<?php esc_attr_e( 'Open side menu', 'booking' ); ?>"> | |
| 924 | + <button type="button" class="wpbc_ui__left_sidebar__side_button wpbc_ui__hide wpbc_ui__top_nav__btn_open_left_vertical_nav" | |
| 925 | + onclick="event.stopPropagation(); wpbc_admin_ui__sidebar_left__do_max( true ); return false;" title="<?php esc_attr_e( 'Open side menu', 'booking' ); ?>"> | |
| 772 | 926 | <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> |
| 773 | 927 | <path fill="#6B6B6B" d="M16.5 22a1.003 1.003 0 0 1-.71-.29l-9-9a1 1 0 0 1 0-1.42l9-9a1.004 1.004 0 1 1 1.42 1.42L8.91 12l8.3 8.29A.999.999 0 0 1 16.5 22Z"></path> |
| 774 | 928 | </svg> |
| 775 | 929 | </button> |
| @@ -863,8 +1017,19 @@ | ||
| 863 | 1017 | do_action( 'wpbc_ui__right_vertical_sidebar_content', $active_page_arr ); |
| 864 | 1018 | |
| 865 | 1019 | echo ' </div><!-- wpbc_ui_el__vert_right_bar__root_sections_container -->'; |
| 866 | 1020 | echo ' </div><!-- wpbc_ui_el__vert_right_bar__content -->'; |
| 1021 | + | |
| 1022 | + /** | |
| 1023 | + * Render an optional page-specific footer outside the scrollable inspector. | |
| 1024 | + * | |
| 1025 | + * Callbacks should render the complete footer element and use the native | |
| 1026 | + * `wpbc_ui_el__vert_right_bar__footer_section` class for positioning. | |
| 1027 | + * | |
| 1028 | + * @param array $active_page_arr Active page, tab, and subtab identifiers. | |
| 1029 | + */ | |
| 1030 | + do_action( 'wpbc_ui__right_vertical_sidebar_footer', $active_page_arr ); | |
| 1031 | + | |
| 867 | 1032 | echo '</div><!-- wpbc_ui_el__vert_right_bar__wrapper -->'; |
| 868 | 1033 | |
| 869 | 1034 | wpbc_start_element_scrollable__with_simplebar( '.wpbc_ui_el__vert_right_bar__wrapper .wpbc_ui_el__vert_right_bar__content' ); |
| 870 | 1035 | } |