Automattic\WooCommerce\Internal\Admin\Logging\FileV2
FileListTable::prepare_items
Prepares the list of items for displaying.
Method of the class: FileListTable{}
No Hooks.
Returns
null. Nothing (null).
Usage
$FileListTable = new FileListTable(); $FileListTable->prepare_items(): void;
FileListTable::prepare_items() FileListTable::prepare items code WC 10.3.3
public function prepare_items(): void {
$per_page = $this->get_items_per_page(
self::PER_PAGE_USER_OPTION_KEY,
$this->get_per_page_default()
);
$defaults = array(
'per_page' => $per_page,
'offset' => ( $this->get_pagenum() - 1 ) * $per_page,
);
$file_args = wp_parse_args(
$this->page_controller->get_query_params( array( 'order', 'orderby', 'source' ) ),
$defaults
);
$total_items = $this->file_controller->get_files( $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;
}
$total_pages = ceil( $total_items / $per_page );
$items = $this->file_controller->get_files( $file_args );
$this->items = $items;
$this->set_pagination_args(
array(
'per_page' => $per_page,
'total_items' => $total_items,
'total_pages' => $total_pages,
)
);
}