ACF_Admin_Internal_Post_Type_List::admin_table_views
Customizes the admin table subnav.
Метод класса: ACF_Admin_Internal_Post_Type_List{}
Хуков нет.
Возвращает
Массив.
Использование
$ACF_Admin_Internal_Post_Type_List = new ACF_Admin_Internal_Post_Type_List(); $ACF_Admin_Internal_Post_Type_List->admin_table_views( $views );
- $views(массив) (обязательный)
- The available views.
Список изменений
| С версии 5.9.0 | Введена. |
Код ACF_Admin_Internal_Post_Type_List::admin_table_views() ACF Admin Internal Post Type List::admin table views ACF 6.4.2
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;
}