mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
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:
parent
62a91851de
commit
3ad78c4ec5
@ -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;
|
||||
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'];
|
||||
sort( $priorities );
|
||||
|
||||
$sorted = array();
|
||||
foreach ( $priorities as $list ) {
|
||||
foreach ( $list as $tab ) {
|
||||
$sorted[ $tab['id'] ] = $tab;
|
||||
}
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user