Changeset 6772 for trunk/src/includes/admin/forums.php
- Timestamp:
- 01/23/2018 11:26:56 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/admin/forums.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/forums.php
r6771 r6772 475 475 476 476 /** 477 * Returns an array of keys used to sort row actions 478 * 479 * @since 2.6.0 bbPress (r6771) 480 * 481 * @return array 482 */ 483 private function get_row_action_sort_order() { 484 485 // Filter & return 486 return (array) apply_filters( 'bbp_admin_forum_row_action_sort_order', array( 487 'edit', 488 'closed', 489 'trash', 490 'untrash', 491 'delete', 492 'view' 493 ) ); 494 } 495 496 /** 477 497 * Returns an array of notice toggles 478 498 * … … 596 616 * @since 2.0.0 bbPress (r2577) 597 617 * 598 * @param array $actions Actions 599 * @param array $forum Forum object 618 * @param array $actions Actions 619 * @param object $forum Topic object 620 * 600 621 * @return array $actions Actions 601 622 */ 602 public function row_actions( $actions, $forum ) { 603 623 public function row_actions( $actions = array(), $forum = false ) { 624 625 // Disable quick edit (too much to do here) 604 626 unset( $actions['inline hide-if-no-js'] ); 605 627 … … 621 643 bbp_forum_content( $forum->ID ); 622 644 623 return $actions; 645 // Sort & return 646 return $this->sort_row_actions( $actions ); 647 } 648 649 /** 650 * Sort row actions by key 651 * 652 * @since 2.6.0 653 * 654 * @param array $actions 655 * 656 * @return array 657 */ 658 private function sort_row_actions( $actions = array() ) { 659 660 // Return value 661 $retval = array(); 662 663 // Known row actions, in sort order 664 $known_actions = $this->get_row_action_sort_order(); 665 666 // Sort known actions, and keep any unknown ones 667 foreach ( $known_actions as $key ) { 668 if ( isset( $actions[ $key ] ) ) { 669 $retval[ $key ] = $actions[ $key ]; 670 unset( $actions[ $key ] ); 671 } 672 } 673 674 // Combine & return 675 return $retval + $actions; 624 676 } 625 677
Note: See TracChangeset
for help on using the changeset viewer.