From 3ad78c4ec58bcda4877b7bdabcf92a3e9c5a7b02 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 22 Sep 2015 03:37:25 +0000 Subject: [PATCH] Help Tabs: when returning help tabs, return them in order of priority, but also return the items in each priority in the order that they were added. Fixes #33941. Built from https://develop.svn.wordpress.org/trunk@34370 git-svn-id: http://core.svn.wordpress.org/trunk@34334 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-screen.php | 35 +++++++++++++++------------ wp-includes/version.php | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index a9064fca46..7d08b2ae4b 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -512,23 +512,26 @@ final class WP_Screen { */ public function get_help_tabs() { $help_tabs = $this->_help_tabs; - uasort( $help_tabs, array( $this, '_sort_help_tabs' ) ); - return $help_tabs; - } - /** - * Compares the difference between the help tabs priorities. - * - * Used for help tabs sorting. - * - * @since 4.4.0 - * - * @param int $tab_a The priority argument for the first tab. - * @param int $tab_b The priority argument for the second tab. - * @return int The difference between the priority arguments. - */ - protected function _sort_help_tabs( $tab_a, $tab_b ) { - return $tab_a['priority'] - $tab_b['priority']; + $priorities = array(); + foreach ( $help_tabs as $help_tab ) { + if ( isset( $priorities[ $help_tab['priority'] ] ) ) { + $priorities[ $help_tab['priority'] ][] = $help_tab; + } else { + $priorities[ $help_tab['priority'] ] = array( $help_tab ); + } + } + + sort( $priorities ); + + $sorted = array(); + foreach ( $priorities as $list ) { + foreach ( $list as $tab ) { + $sorted[ $tab['id'] ] = $tab; + } + } + + return $sorted; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 453f3aa261..dd1ddaa434 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34369'; +$wp_version = '4.4-alpha-34370'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.