Refactor generic tables and page index classes #26

Merged
Roflin merged 9 commits from refactor-tables into master 2021-05-17 20:19:18 +02:00
Showing only changes of commit 6c662481bc - Show all commits

View File

@ -126,20 +126,12 @@ class GenericTable
{ {
foreach ($rows as $i => $row) foreach ($rows as $i => $row)
{ {
$className = $i & 1 ? 'even' : 'odd';
if (isset($options['row_classifier']))
$className .= $options['row_classifier']($row);
$newRow = [ $newRow = [
'class' => $className,
'cells' => [], 'cells' => [],
]; ];
foreach ($options['columns'] as $column) foreach ($options['columns'] as $column)
{ {
if (isset($column['enabled']) && $column['enabled'] == false)
continue;
// The hard way? // The hard way?
if (isset($column['parse'])) if (isset($column['parse']))
{ {
@ -207,7 +199,6 @@ class GenericTable
// Append the cell to the row. // Append the cell to the row.
$newRow['cells'][] = [ $newRow['cells'][] = [
'width' => !empty($column['cell_width']) && is_int($column['cell_width']) ? $column['cell_width'] : null,
'value' => $value, 'value' => $value,
]; ];
} }