/** * Items can have thair detail - toggled * @param mixed $detail callable|string|bool * @param bool|NULL $primary_where_column * @return Column\ItemDetail */ public function setItemsDetail($detail = TRUE, $primary_where_column = NULL) { if ($this->isSortable()) { throw new DataGridException('You can not use both sortable datagrid and items detail.'); } $this->items_detail = new Column\ItemDetail($this, $primary_where_column ?: $this->primary_key); if (is_string($detail)) { /** * Item detail will be in separate template */ $this->items_detail->setType('template'); $this->items_detail->setTemplate($detail); } else { if (is_callable($detail)) { /** * Item detail will be rendered via custom callback renderer */ $this->items_detail->setType('renderer'); $this->items_detail->setRenderer($detail); } else { if (TRUE === $detail) { /** * Item detail will be rendered probably via block #detail */ $this->items_detail->setType('block'); } else { throw new DataGridException('::setItemsDetail() can be called either with no parameters or with parameter = template path or callable renderer.'); } } } return $this->items_detail; }