Internal: Sortable table can return filtered data - refs BT#20575

pull/4635/head
Angel Fernando Quiroz Campos 3 years ago
parent 2c54c7c23c
commit ee1425d531
  1. 24
      main/inc/lib/sortable_table.class.php

@ -355,11 +355,31 @@ class SortableTable extends HTML_Table
echo $this->return_table();
}
public function toArray()
public function toArray($applyFilters = false, $stripTags = false)
{
$headers = array_column($this->getHeaders(), 'label');
return array_merge([$headers], $this->table_data);
if ($stripTags) {
$headers = array_map('strip_tags', $headers);
}
if ($applyFilters) {
$data = [];
foreach ($this->table_data as $row) {
$filtered = $this->filter_data($row);
if ($stripTags) {
$filtered = array_map('strip_tags', $filtered);
}
$data[] = $filtered;
}
} else {
$data = $this->table_data;
}
return array_merge([$headers], $data);
}
/**

Loading…
Cancel
Save