diff --git a/src/Table/TableColumn.php b/src/Table/TableColumn.php index 8acc36e..39218a8 100644 --- a/src/Table/TableColumn.php +++ b/src/Table/TableColumn.php @@ -125,7 +125,7 @@ public function renderHeader() return ""; } - if (empty($this->title) && !is_callable($this->value)) { + if (empty($this->title) && !$this->isCallable($this->value)) { if ($this->tableInstance->titlesMode == 'underscore') $this->title = $this->underscoreToTitle($this->value); elseif ($this->tableInstance->titlesMode == 'camelcase') $this->title = $this->camelToTitle($this->value); } @@ -178,7 +178,7 @@ public function renderBody( &$row ) $css = $this->css['td']->render('{prop}:{val}; '); $val = ""; - if (is_callable($this->value)) { + if ($this->isCallable($this->value)) { $val = $this->value; $val = $val($row); } @@ -216,6 +216,15 @@ private function underscoreToTitle($str) return $str; } - - + + + /** + * @param string $var + * @return boolean + */ + private function isCallable($var) + { + return (!is_string($var) && is_callable($var)) || (is_object($var) && $var instanceof \Closure); + } + }