bp_core_admin_help_sub_menu( $directories, $times, $docs_path, $level_hide = 1, $show_as_heading = false, $hide_parent = false )
Display Sub menu of Main Menu
Description
Parameters
- $directories
-
(Required)
- $times
-
(Required)
- $docs_path
-
(Required)
Source
File: bp-core/admin/bp-core-admin-help.php
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | function bp_core_admin_help_sub_menu( $directories , $times , $docs_path , $level_hide = 1, $show_as_heading = false, $hide_parent = false ) { $article = bp_core_admin_help_get_article_value(); $article_path = $docs_path . $article ; if ( empty ( $show_as_heading ) ) { $ul_classed = $times > $level_hide ? 'hidden' : '' ; $ul_classed .= ' loop-' . $times ; ?> <ul class = "<?php echo $ul_classed; ?> " > <?php } do_action( 'bp_core_admin_help_sub_menu_before' , $directories , $times , $docs_path , $level_hide , $show_as_heading , $hide_parent ); // For showing the menu title foreach ( $directories as $directory ) { $dir_pos = false !== strpos ( $article_path , $directory ) ? true : false; // use in breadcrumb if ( empty ( $dir_pos ) && ! empty ( $show_as_heading ) ) { continue ; } // add class to menu and sub menu level $slug = bp_core_get_post_slug_by_index( $directory ); $dir_index_file = $directory ; $is_dir = is_dir ( $directory ); if ( $is_dir ) { // the the main file from the directory $dir_index_file = glob ( $directory . "/0-*.md" ); $loop_dir = array_diff ( glob ( $directory . '/*' ), $dir_index_file ); $dir_index_file = current( $dir_index_file ); $url = add_query_arg( 'article' , str_replace ( $docs_path , "" , $dir_index_file ) ); } // check condition on file deleted $file_delete = false !== strpos ( $dir_index_file , 'delete-' ) ? true : false; if ( ! empty ( $file_delete ) ) { continue ; } $selected = $dir_index_file == $article_path ? 'selected main' : 'main' ; $selected .= ' level-' . $times . ' ' . $slug ; ?> <li class = "<?php echo $selected; ?>" > <?php // check if it's has directory if ( $is_dir ) { if ( ! empty ( $loop_dir ) ) { /** * Count variable is getting updated via JS */ $count_html = sprintf( '<span class="sub-menu-count">(%s)</span>' , 0 ); $action = '<span class="actions"><span class="open">+</span></span>' ; if ( ( $article && 1 == $times ) || ! empty ( $show_as_heading ) ) { $action = '' ; $count_html = '' ; } if ( empty ( $hide_parent ) && ! empty ( $dir_index_file ) ) { printf( '<a href="%s" class="dir">%s %s</a>%s' , $url , bp_core_admin_help_get_file_title( $dir_index_file ), $count_html , $action ); } if ( ! empty ( $show_as_heading ) ) { ?> </li> <?php } bp_core_admin_help_sub_menu( $loop_dir , $times + 1, $docs_path , $level_hide , $show_as_heading ); } else if ( empty ( $hide_parent ) ) { printf( '<a href="%s" class="dir">%s</a>' , $url , bp_core_admin_help_get_file_title( $dir_index_file ) ); } } elseif ( empty ( $hide_parent ) ) { $url = add_query_arg( 'article' , str_replace ( $docs_path , "" , $directory ) ); // print the title if it's a .md file printf( '<a href="%s" class="file">%s</a>' , $url , bp_core_admin_help_get_file_title( $directory ) ); } ?> </li> <?php } do_action( 'bp_core_admin_help_sub_menu_after' , $directories , $times , $docs_path , $level_hide , $show_as_heading , $hide_parent ); if ( empty ( $show_as_heading ) ) { ?> </ul> <?php } } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.