WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Privacy_Requests_Table::get_views() protected WP 4.9.6

Get an associative array ( id => link ) with the list of views available on this table.

Это метод класса: WP_Privacy_Requests_Table{}

Хуков нет.

Возвращает

Строку[]. An array of HTML links keyed by their view.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_views();

Список изменений

С версии 4.9.6 Введена.

Код WP Privacy Requests Table::get views: wp-admin/includes/class-wp-privacy-requests-table.php WP 5.5.1

<?php
protected function get_views() {
	$current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
	$statuses       = _wp_privacy_statuses();
	$views          = array();
	$counts         = $this->get_request_counts();
	$total_requests = absint( array_sum( (array) $counts ) );

	// Normalized admin URL.
	$admin_url = $this->get_admin_url();

	$current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
	$status_label            = sprintf(
		/* translators: %s: Number of requests. */
		_nx(
			'All <span class="count">(%s)</span>',
			'All <span class="count">(%s)</span>',
			$total_requests,
			'requests'
		),
		number_format_i18n( $total_requests )
	);

	$views['all'] = sprintf(
		'<a href="%s"%s>%s</a>',
		esc_url( $admin_url ),
		$current_link_attributes,
		$status_label
	);

	foreach ( $statuses as $status => $label ) {
		$post_status = get_post_status_object( $status );
		if ( ! $post_status ) {
			continue;
		}

		$current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
		$total_status_requests   = absint( $counts->{$status} );

		if ( ! $total_status_requests ) {
			continue;
		}

		$status_label = sprintf(
			translate_nooped_plural( $post_status->label_count, $total_status_requests ),
			number_format_i18n( $total_status_requests )
		);

		$status_link = add_query_arg( 'filter-status', $status, $admin_url );

		$views[ $status ] = sprintf(
			'<a href="%s"%s>%s</a>',
			esc_url( $status_link ),
			$current_link_attributes,
			$status_label
		);
	}

	return $views;
}