WC_Admin_Webhooks_Table_List::prepare_items()
Prepare table list items.
Method of the class: WC_Admin_Webhooks_Table_List{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_Webhooks_Table_List = new WC_Admin_Webhooks_Table_List(); $WC_Admin_Webhooks_Table_List->prepare_items();
WC_Admin_Webhooks_Table_List::prepare_items() WC Admin Webhooks Table List::prepare items code WC 9.4.2
public function prepare_items() { $per_page = $this->get_items_per_page( 'woocommerce_webhooks_per_page' ); $current_page = $this->get_pagenum(); // Query args. $args = array( 'limit' => $per_page, 'offset' => $per_page * ( $current_page - 1 ), ); // Handle the status query. if ( ! empty( $_REQUEST['status'] ) ) { // WPCS: input var okay, CSRF ok. $args['status'] = sanitize_key( wp_unslash( $_REQUEST['status'] ) ); // WPCS: input var okay, CSRF ok. } if ( ! empty( $_REQUEST['s'] ) ) { // WPCS: input var okay, CSRF ok. $args['search'] = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: input var okay, CSRF ok. } $args['paginate'] = true; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( 'true' === sanitize_key( wp_unslash( $_REQUEST['legacy'] ?? null ) ) ) { $args['api_version'] = -1; } // Get the webhooks. $data_store = WC_Data_Store::load( 'webhook' ); $webhooks = $data_store->search_webhooks( $args ); $this->items = array_map( 'wc_get_webhook', $webhooks->webhooks ); // Set the pagination. $this->set_pagination_args( array( 'total_items' => $webhooks->total, 'per_page' => $per_page, 'total_pages' => $webhooks->max_num_pages, ) ); }