dashboard-navigation.php
64 lines
| 1 | <?php |
| 2 | // defaults. |
| 3 | $is_mobile = $is_mobile ?? false; |
| 4 | $show_account = $show_account ?? false; |
| 5 | $navigation = $navigation ?? []; |
| 6 | $account_navigation = $account_navigation ?? []; |
| 7 | ?> |
| 8 | |
| 9 | <?php echo ! empty( $is_mobile ) ? '<sc-menu>' : '<sc-spacing style="--spacing: var(--sc-spacing-xx-small);">'; ?> |
| 10 | |
| 11 | <?php foreach ( $navigation as $key => $item ) : ?> |
| 12 | <?php |
| 13 | \SureCart::render( |
| 14 | 'layouts/partials/customer-dashboard/dashboard-menu-item', |
| 15 | [ |
| 16 | 'icon_name' => $item['icon_name'], |
| 17 | 'name' => $item['name'], |
| 18 | 'active' => $item['active'], |
| 19 | 'href' => $item['href'], |
| 20 | 'is_mobile' => $is_mobile, |
| 21 | ] |
| 22 | ); |
| 23 | ?> |
| 24 | <?php endforeach; ?> |
| 25 | |
| 26 | <?php if ( $show_account ) : ?> |
| 27 | <sc-menu-divider></sc-menu-divider> |
| 28 | |
| 29 | <?php foreach ( $account_navigation as $navigation ) : ?> |
| 30 | <?php |
| 31 | \SureCart::render( |
| 32 | 'layouts/partials/customer-dashboard/dashboard-menu-item', |
| 33 | [ |
| 34 | 'icon_name' => $navigation['icon_name'], |
| 35 | 'name' => $navigation['name'], |
| 36 | 'active' => $navigation['active'], |
| 37 | 'href' => $navigation['href'], |
| 38 | 'is_mobile' => $is_mobile, |
| 39 | ] |
| 40 | ); |
| 41 | ?> |
| 42 | <?php endforeach; ?> |
| 43 | |
| 44 | <?php if ( ! empty( $account_navigation ) ) : ?> |
| 45 | <sc-menu-divider></sc-menu-divider> |
| 46 | <?php endif; ?> |
| 47 | |
| 48 | <?php |
| 49 | \SureCart::render( |
| 50 | 'layouts/partials/customer-dashboard/dashboard-menu-item', |
| 51 | [ |
| 52 | 'icon_name' => 'log-out', |
| 53 | 'name' => __( 'Log Out', 'surecart' ), |
| 54 | 'active' => false, |
| 55 | 'href' => $data['logout_link'] ?? wp_logout_url( get_permalink() ), |
| 56 | 'is_mobile' => $is_mobile, |
| 57 | ] |
| 58 | ); |
| 59 | ?> |
| 60 | <?php endif; ?> |
| 61 | |
| 62 | <?php |
| 63 | echo ! empty( $is_mobile ) ? '</sc-menu>' : '</sc-spacing>'; |
| 64 |