diff --git a/src/Elements/Table.php b/src/Elements/Table.php index 083da86..0df367b 100644 --- a/src/Elements/Table.php +++ b/src/Elements/Table.php @@ -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; } @@ -204,8 +210,7 @@ public function hideHeaderlessColumns(): Table { * * @return TableRow */ - public function getHeader(): TableRow - { + public function getHeader(): TableRow { return $this->header; } @@ -214,8 +219,7 @@ public function getHeader(): TableRow * * @return array */ - public function getRows(): array - { + public function getRows(): array { return $this->rows; } }