Skip to content

Commit

Permalink
Temporary solution for pseudo header values
Browse files Browse the repository at this point in the history
  • Loading branch information
JPustkuchen committed Jul 2, 2021
1 parent d618f09 commit 2fa5d5b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Elements/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ public function __construct(Environment $twig, ?TableRow $header = null, array $
* @return Table
*/
public function setHeaderFromArray(array $headerArray): Table {
$this->setHeader(TableRow::createFromArray($headerArray));
$headerTableRow = TableRow::createFromArray($headerArray);
$headerTableRow->iterateCells(function (TableCell $cell, $index) {
if ($cell->getValue() === null) {
$cell->setHidden(true);
}
});
$this->setHeader($headerTableRow);
return $this;
}

Expand Down Expand Up @@ -204,8 +210,7 @@ public function hideHeaderlessColumns(): Table {
*
* @return TableRow
*/
public function getHeader(): TableRow
{
public function getHeader(): TableRow {
return $this->header;
}

Expand All @@ -214,8 +219,7 @@ public function getHeader(): TableRow
*
* @return array
*/
public function getRows(): array
{
public function getRows(): array {
return $this->rows;
}
}

0 comments on commit 2fa5d5b

Please sign in to comment.