Start refactor work on GenericTables #51

Open
Aaron wants to merge 11 commits from generic-tables into master
Showing only changes of commit e57289eeb6 - Show all commits

View File

@ -41,7 +41,7 @@ class GenericTable
$this->tableIsSortable = !empty($options['base_url']); $this->tableIsSortable = !empty($options['base_url']);
// How much data do we have? // How much data do we have?
$this->recordCount = $options['get_count'](...(!empty($options['get_count_params']) ? $options['get_count_params'] : [])); $this->recordCount = $options['get_count']();
// How much data do we need to retrieve? // How much data do we need to retrieve?
$this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30; $this->items_per_page = !empty($options['items_per_page']) ? $options['items_per_page'] : 30;
@ -58,8 +58,6 @@ class GenericTable
// Gather parameters for the data gather function first. // Gather parameters for the data gather function first.
$parameters = [$this->start, $this->items_per_page, $options['sort_order'], $options['sort_direction']]; $parameters = [$this->start, $this->items_per_page, $options['sort_order'], $options['sort_direction']];
if (!empty($options['get_data_params']) && is_array($options['get_data_params']))
$parameters = array_merge($parameters, $options['get_data_params']);
// Okay, let's fetch the data! // Okay, let's fetch the data!
$data = $options['get_data'](...$parameters); $data = $options['get_data'](...$parameters);