ACF_Admin_Field_Groups::admin_table_views()publicACF 5.9.0

Customizes the admin table subnav.

Метод класса: ACF_Admin_Field_Groups{}

Хуков нет.

Возвращает

Массив.

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

$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups();
$ACF_Admin_Field_Groups->admin_table_views( $views );
$views(массив) (обязательный)
The available views.

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

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

Код ACF_Admin_Field_Groups::admin_table_views() ACF 6.0.4

public function admin_table_views( $views ) {
	global $wp_list_table, $wp_query;

	// Count items.
	$count = count( $this->sync );

	// Append "sync" link to subnav.
	if ( $count ) {
		$views['sync'] = sprintf(
			'<a %s href="%s">%s <span class="count">(%s)</span></a>',
			( $this->view === 'sync' ? 'class="current"' : '' ),
			esc_url( $this->get_admin_url( '&post_status=sync' ) ),
			esc_html( __( 'Sync available', 'acf' ) ),
			$count
		);
	}

	// Modify table pagination args to match JSON data.
	if ( $this->view === 'sync' ) {
		$wp_list_table->set_pagination_args(
			array(
				'total_items' => $count,
				'total_pages' => 1,
				'per_page'    => $count,
			)
		);
		$wp_query->post_count = 1; // At least one post is needed to render bulk drop-down.
	}
	return $views;
}