, Ruben Garcia * * @since 1.0.0 */ // Exit if accessed directly defined( 'ABSPATH' ) || exit; /** * Render an ajax list table * * @since 1.0.0 * * @param CT_Table|string $table CT_Table object or CT_Table name * @param array $query_args Query parameters * @param array $view_args View parameters */ function ct_render_ajax_list_table( $table, $query_args = array(), $view_args = array() ) { global $ct_table, $ct_query, $ct_list_table, $ct_ajax_list_items_per_page; $ct_table = ct_setup_table( $table ); if( is_object( $ct_table ) ) { // Setup this constant to allow from CT_List_Table meet that this render comes from this plugin @define( 'IS_CT_AJAX_LIST_TABLE', true ); // Enqueue assets ct_ajax_list_table_enqueue_scripts(); // Setup query args $query_args = wp_parse_args( $query_args, array( 'paged' => 1, 'items_per_page' => 20, ) ); // setup view args $view_args = wp_parse_args( $view_args, array( 'views' => true, 'search_box' => true, ) ); // Add a filter to override the items per page user setting $ct_ajax_list_items_per_page = $query_args['items_per_page']; add_filter( 'edit_' . $ct_table->name . '_per_page', 'ct_ajax_list_override_items_per_page' ); // Set up vars $ct_query = new CT_Query( $query_args ); $ct_list_table = new CT_List_Table(); $ct_list_table->prepare_items(); ?>
"> views(); } ?> ?> search_box( $ct_table->labels->search_items, $ct_table->name ); } ?> print_column_headers(); ?> _args['singular']; ?> > display_rows_or_placeholder(); ?> print_column_headers( false ); ?>
?>

has_items() ): ?>
bulk_actions( $which ); ?>
extra_tablenav( $which ); $ct_list_table->pagination( $which ); ?>