Automattic\WooCommerce\Internal\Admin\Logging\FileV2
SearchListTable::prepare_items()
Prepares the list of items for displaying.
Метод класса: SearchListTable{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$SearchListTable = new SearchListTable(); $SearchListTable->prepare_items(): void;
Код SearchListTable::prepare_items() SearchListTable::prepare items WC 9.7.1
public function prepare_items(): void { $per_page = $this->get_items_per_page( self::PER_PAGE_USER_OPTION_KEY, $this->get_per_page_default() ); $args = array( 'per_page' => $per_page, 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, ); $file_args = $this->page_controller->get_query_params( array( 'date_end', 'date_filter', 'date_start', 'order', 'orderby', 'search', 'source' ) ); $search = $file_args['search']; unset( $file_args['search'] ); $total_items = $this->file_controller->search_within_files( $search, $args, $file_args, true ); if ( is_wp_error( $total_items ) ) { printf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html( $total_items->get_error_message() ) ); return; } if ( $total_items >= $this->file_controller::SEARCH_MAX_RESULTS ) { printf( '<div class="notice notice-info"><p>%s</p></div>', sprintf( // translators: %s is a number. esc_html__( 'The number of search results has reached the limit of %s. Try refining your search.', 'woocommerce' ), esc_html( number_format_i18n( $this->file_controller::SEARCH_MAX_RESULTS ) ) ) ); } $total_pages = ceil( $total_items / $per_page ); $results = $this->file_controller->search_within_files( $search, $args, $file_args ); $this->items = $results; $this->set_pagination_args( array( 'per_page' => $per_page, 'total_items' => $total_items, 'total_pages' => $total_pages, ) ); }