diff --git a/src/Display/DisplayTable.php b/src/Display/DisplayTable.php index a973a21c7..290a87304 100644 --- a/src/Display/DisplayTable.php +++ b/src/Display/DisplayTable.php @@ -87,6 +87,16 @@ class DisplayTable implements Renderable, DisplayInterface */ protected $paginate; + /** + * @var Column\Control + */ + protected $controlColumn; + + public function __construct() + { + $this->controlColumn = TableColumn::control(); + } + /** * @param string $class */ @@ -105,6 +115,26 @@ public function getClass() return $this->class; } + /** + * @param ColumnInterface $controlColumn + * + * @return $this + */ + public function setControlColumn(ColumnInterface $controlColumn) + { + $this->controlColumn = $controlColumn; + + return $this; + } + + /** + * @return Column\Control + */ + public function getControlColumn() + { + return $this->controlColumn; + } + public function initialize() { Meta::loadPackage(get_called_class()); @@ -147,8 +177,9 @@ public function setColumns(array $columns) public function getAllColumns() { $columns = $this->getColumns(); + if ($this->isControlActive()) { - $columns[] = TableColumn::control(); + $columns[] = $this->getControlColumn(); } return $columns; @@ -180,6 +211,8 @@ public function setWith($with) /** * @param Closure $apply + * + * @return $this */ public function setApply(Closure $apply) {