diff --git a/src/Bootstrapper/Table.php b/src/Bootstrapper/Table.php index 1da55a1e..05c304c5 100644 --- a/src/Bootstrapper/Table.php +++ b/src/Bootstrapper/Table.php @@ -75,6 +75,8 @@ class Table extends RenderedObject */ protected $columnClasses = []; + protected $headercaptions; + /** * Renders the table * @@ -314,6 +316,11 @@ public function only(array $only) return $this; } + public function withHeaderCaptions(array $x){ + $this->headercaptions = $x; + return $this; + } + private function renderHeaders() { $headers = $this->getHeaders(); @@ -322,6 +329,12 @@ private function renderHeaders() return ''; } + if(is_array($this->headercaptions)): + foreach($headers as $key=>$val): + if(!empty($this->headercaptions[$val])) $headers[$key] = $this->headercaptions[$val]; + endforeach; + endif; + $string = ''; foreach ($headers as $heading) { if (isset($this->columnClasses[$heading])) {