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. git-svn-id: https://develop.svn.wordpress.org/trunk@46211 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6b65af939f
commit
e31bd15ab5
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue