Changeset 12897 for trunk/src/bp-core/admin/bp-core-admin-functions.php
- Timestamp:
- 04/20/2021 04:02:22 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-functions.php
r12886 r12897 390 390 * 391 391 * @since 1.5.0 392 * @since 8.0.0 Adds the `$context` parameter. 392 393 * 393 394 * @param string $active_tab Name of the tab that is active. Optional. 394 */ 395 function bp_core_admin_tabs( $active_tab = '' ) { 395 * @param string $context The context of use for the tabs. Defaults to 'settings'. 396 * Possible values are 'settings' & 'tools'. 397 */ 398 function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) { 396 399 $tabs_html = ''; 397 400 $idle_class = 'nav-tab'; … … 405 408 * @param array $value Array of tabs to output to the admin area. 406 409 */ 407 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) );410 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) ); 408 411 409 412 // Loop through tabs and build navigation. … … 420 423 * 421 424 * @since 1.5.0 425 * @since 8.0.0 Adds the `$context` parameter. 426 * 427 * @param string $context The context of use for the tabs. 422 428 */ 423 do_action( 'bp_admin_tabs' );429 do_action( 'bp_admin_tabs', $context ); 424 430 } 425 431 … … 428 434 * 429 435 * @since 2.2.0 436 * @since 8.0.0 Adds the `$context` parameter. 430 437 * 431 438 * @param string $active_tab Name of the tab that is active. Optional. 439 * @param string $context The context of use for the tabs. Defaults to 'settings'. 440 * Possible values are 'settings' & 'tools'. 432 441 * @return string 433 442 */ 434 function bp_core_get_admin_tabs( $active_tab = '' ) { 435 $tabs = array( 436 '0' => array( 437 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ), 438 'name' => __( 'Components', 'buddypress' ), 439 ), 440 '2' => array( 441 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), 442 'name' => __( 'Options', 'buddypress' ), 443 ), 444 '1' => array( 445 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ), 446 'name' => __( 'Pages', 'buddypress' ), 447 ), 448 '3' => array( 449 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ), 450 'name' => __( 'Credits', 'buddypress' ), 451 ), 452 ); 443 function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 444 $tabs = array(); 445 446 if ( 'settings' === $context ) { 447 $tabs = array( 448 '0' => array( 449 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ), 450 'name' => __( 'Components', 'buddypress' ), 451 ), 452 '2' => array( 453 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), 454 'name' => __( 'Options', 'buddypress' ), 455 ), 456 '1' => array( 457 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ), 458 'name' => __( 'Pages', 'buddypress' ), 459 ), 460 '3' => array( 461 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ), 462 'name' => __( 'Credits', 'buddypress' ), 463 ), 464 ); 465 } elseif ( 'tools' === $context ) { 466 $tools_page = 'tools.php'; 467 if ( bp_core_do_network_admin() ) { 468 $tools_page = 'admin.php'; 469 } 470 471 $tabs = array( 472 '0' => array( 473 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ), 474 'name' => __( 'Repair', 'buddypress' ), 475 ), 476 ); 477 } 453 478 454 479 /** … … 456 481 * 457 482 * @since 2.2.0 483 * @since 8.0.0 Adds the `$context` parameter. 458 484 * 459 * @param array $tabs Tab data. 485 * @param array $tabs Tab data. 486 * @param string $context The context of use for the tabs. 460 487 */ 461 return apply_filters( 'bp_core_get_admin_tabs', $tabs );488 return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context ); 462 489 } 463 490
Note: See TracChangeset
for help on using the changeset viewer.