Changeset 9205
- Timestamp:
- 11/29/2014 07:57:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-functions.php
r9172 r9205 372 372 * 373 373 * @since BuddyPress (1.5) 374 * @param string $active_tab Name of the tab that is active 374 * @param string $active_tab Name of the tab that is active. Optional. 375 375 */ 376 376 function bp_core_admin_tabs( $active_tab = '' ) { 377 378 // Declare local variables379 377 $tabs_html = ''; 380 378 $idle_class = 'nav-tab'; 381 379 $active_class = 'nav-tab nav-tab-active'; 382 383 // Setup core admin tabs 380 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) ); 381 382 // Loop through tabs and build navigation 383 foreach ( array_values( $tabs ) as $tab_data ) { 384 $is_current = (bool) ( $tab_data['name'] == $active_tab ); 385 $tab_class = $is_current ? $active_class : $idle_class; 386 $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 387 } 388 389 echo $tabs_html; 390 do_action( 'bp_admin_tabs' ); 391 } 392 393 /** 394 * Get the data for the tabs in the admin area. 395 * 396 * @since BuddyPress (2.2.0) 397 * @param string $active_tab Name of the tab that is active. Optional. 398 */ 399 function bp_core_get_admin_tabs( $active_tab = '' ) { 384 400 $tabs = array( 385 401 '0' => array( … … 410 426 } 411 427 412 // Allow the tabs to be filtered 413 $tabs = apply_filters( 'bp_core_admin_tabs', $tabs ); 414 415 // Loop through tabs and build navigation 416 foreach ( array_values( $tabs ) as $tab_data ) { 417 $is_current = (bool) ( $tab_data['name'] == $active_tab ); 418 $tab_class = $is_current ? $active_class : $idle_class; 419 $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 420 } 421 422 // Output the tabs 423 echo $tabs_html; 424 425 // Do other fun things 426 do_action( 'bp_admin_tabs' ); 428 /** 429 * Filters the tab data used in our wp-admin screens. 430 * 431 * @param array $tabs Tab data. 432 * @since BuddyPress (2.2.0) 433 */ 434 return apply_filters( 'bp_core_get_admin_tabs', $tabs ); 427 435 } 428 436
Note: See TracChangeset
for help on using the changeset viewer.