Privacy: Include request counts inline with the filters in the list table views.

Fixes $44952
Props eArtboard, pratikkry, birgire, garrett-eclipse.
Built from https://develop.svn.wordpress.org/trunk@44668


git-svn-id: http://core.svn.wordpress.org/trunk@44499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-01-21 17:35:51 +00:00
parent f93ccded3f
commit eaa03c3c8c
3 changed files with 9 additions and 3 deletions

View File

@ -1164,13 +1164,15 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
$views = array();
$admin_url = admin_url( 'tools.php?page=' . $this->request_type );
$counts = $this->get_request_counts();
$total_requests = absint( array_sum( (array) $counts ) );
$current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
$views['all'] = '<a href="' . esc_url( $admin_url ) . "\" $current_link_attributes>" . esc_html__( 'All' ) . ' <span class="count">(' . absint( array_sum( (array) $counts ) ) . ')</span></a>';
$views['all'] = '<a href="' . esc_url( $admin_url ) . "\" $current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%d)</span>', $total_requests, 'requests' ), number_format_i18n( $total_requests ) ) . '</a>';
foreach ( $statuses as $status => $label ) {
$current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
$views[ $status ] = '<a href="' . esc_url( add_query_arg( 'filter-status', $status, $admin_url ) ) . "\" $current_link_attributes>" . esc_html( $label ) . ' <span class="count">(' . absint( $counts->$status ) . ')</span></a>';
$total_status_requests = absint( $counts->$status );
$views[ $status ] = '<a href="' . esc_url( add_query_arg( 'filter-status', $status, $admin_url ) ) . "\" $current_link_attributes>" . sprintf( _nx( '%1$s <span class="count">(%2$d)</span>', '%1$s <span class="count">(%2$d)</span>', $total_status_requests, 'requests' ), esc_html( $label ), number_format_i18n( $total_status_requests ) ) . '</a>';
}
return $views;

View File

@ -391,6 +391,7 @@ function create_initial_post_types() {
'label' => _x( 'Pending', 'request status' ),
'internal' => true,
'_builtin' => true, /* internal use only. */
'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
'exclude_from_search' => false,
)
);
@ -401,6 +402,7 @@ function create_initial_post_types() {
'label' => _x( 'Confirmed', 'request status' ),
'internal' => true,
'_builtin' => true, /* internal use only. */
'label_count' => _n_noop( 'Confirmed <span class="count">(%s)</span>', 'Confirmed <span class="count">(%s)</span>' ),
'exclude_from_search' => false,
)
);
@ -411,6 +413,7 @@ function create_initial_post_types() {
'label' => _x( 'Failed', 'request status' ),
'internal' => true,
'_builtin' => true, /* internal use only. */
'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>' ),
'exclude_from_search' => false,
)
);
@ -421,6 +424,7 @@ function create_initial_post_types() {
'label' => _x( 'Completed', 'request status' ),
'internal' => true,
'_builtin' => true, /* internal use only. */
'label_count' => _n_noop( 'Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>' ),
'exclude_from_search' => false,
)
);

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44667';
$wp_version = '5.1-beta1-44668';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.