Networks and Sites: Add support for the extra_tablenav() method in WP_MS_Sites_List_Table.

This method allows additional filters or other UI components to be added to the top and bottom of the `WP_List_Table` between the bulk actions dropdown and search input field.

Fixes #45954.
Props pbiron, desrosj.
Built from https://develop.svn.wordpress.org/trunk@46211


git-svn-id: http://core.svn.wordpress.org/trunk@46023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-09-20 20:53:58 +00:00
parent a9aefc83bc
commit ba2700068d
3 changed files with 48 additions and 8 deletions

View File

@ -230,6 +230,48 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
}
/**
* Extra controls to be displayed between bulk actions and pagination.
*
* @since 5.3.0
*
* @param string $which
*/
protected function extra_tablenav( $which ) {
?>
<div class="alignleft actions">
<?php
if ( 'top' === $which ) {
ob_start();
/**
* Fires before the Filter button on the MS sites list table.
*
* @since 5.3.0
*
* @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
*/
do_action( 'restrict_manage_sites', $which );
$output = ob_get_clean();
if ( ! empty( $output ) ) {
echo $output;
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );
}
}
?>
</div>
<?php
/**
* Fires immediately following the closing "actions" div in the tablenav for the
* MS sites list table.
*
* @since 5.3.0
*
* @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
*/
do_action( 'manage_sites_extra_tablenav', $which );
}
/**
* @return array
*/

View File

@ -231,14 +231,12 @@ if ( isset( $_GET['action'] ) ) {
wp_safe_redirect( $redirect_to );
exit();
}
} else {
$location = network_admin_url( 'sites.php' );
if ( ! empty( $_REQUEST['paged'] ) ) {
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
}
wp_redirect( $location );
exit();
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
// process query defined by WP_MS_Site_List_Table::extra_table_nav().
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
exit;
}
break;
case 'archiveblog':

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-46210';
$wp_version = '5.3-alpha-46211';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.