forked from Public/pics
Minor refactor of generateColumnHeaders function
This commit is contained in:
parent
ff808ba18d
commit
4bf4641428
@ -93,10 +93,13 @@ class GenericTable
|
|||||||
if (empty($column['header']))
|
if (empty($column['header']))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$isSortable = $this->tableIsSortable && !empty($column['is_sortable']);
|
||||||
|
$sortDirection = $key == $this->sort_order && $this->sort_direction === 'up' ? 'down' : 'up';
|
||||||
|
|
||||||
$header = [
|
$header = [
|
||||||
'class' => isset($column['class']) ? $column['class'] : '',
|
'class' => isset($column['class']) ? $column['class'] : '',
|
||||||
'colspan' => !empty($column['header_colspan']) ? $column['header_colspan'] : 1,
|
'colspan' => !empty($column['header_colspan']) ? $column['header_colspan'] : 1,
|
||||||
'href' => !$this->tableIsSortable || empty($column['is_sortable']) ? '' : $this->getLink($this->start, $key, $key == $this->sort_order && $this->sort_direction == 'up' ? 'down' : 'up'),
|
'href' => $isSortable ? $this->getLink($this->start, $key, $sortDirection) : null,
|
||||||
'label' => $column['header'],
|
'label' => $column['header'],
|
||||||
'scope' => 'col',
|
'scope' => 'col',
|
||||||
'sort_mode' => $key == $this->sort_order ? $this->sort_direction : null,
|
'sort_mode' => $key == $this->sort_order ? $this->sort_direction : null,
|
||||||
|
Loading…
Reference in New Issue
Block a user