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
This commit is contained in:
Scott Taylor 2015-09-22 03:37:25 +00:00
parent 62a91851de
commit 3ad78c4ec5
2 changed files with 20 additions and 17 deletions

View File

@ -512,23 +512,26 @@ final class WP_Screen {
*/ */
public function get_help_tabs() { public function get_help_tabs() {
$help_tabs = $this->_help_tabs; $help_tabs = $this->_help_tabs;
uasort( $help_tabs, array( $this, '_sort_help_tabs' ) );
return $help_tabs; $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 );
* Compares the difference between the help tabs priorities.
* $sorted = array();
* Used for help tabs sorting. foreach ( $priorities as $list ) {
* foreach ( $list as $tab ) {
* @since 4.4.0 $sorted[ $tab['id'] ] = $tab;
* }
* @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. return $sorted;
*/
protected function _sort_help_tabs( $tab_a, $tab_b ) {
return $tab_a['priority'] - $tab_b['priority'];
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.