table_data = $table_data; } /** * Get table data to show on current page. * * @see SortableTable#get_table_data */ public function get_table_data( $from = 1, $per_page = null, $column = null, $direction = null, $sort = true ) { if ($sort) { $content = TableSort::sort_table( $this->table_data, $this->column, $this->direction === 'ASC' ? SORT_ASC : SORT_DESC ); } else { $content = $this->table_data; } return array_slice($content, $from, $this->per_page); } /** * Get total number of items. * * @see SortableTable#get_total_number_of_items */ public function get_total_number_of_items() { if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) { return $this->total_number_of_items; } else { if (!empty($this->table_data)) { return count($this->table_data); } return 0; } } }