/** * @param $data * @return array * @throws \Exception */ protected function processInitialData($data) { if (!is_array($data) && !$data instanceof \Traversable) { throw new \Exception('Unable to process data, query result is not traversable.'); } // Load renderer template: $this->renderer->load(isset($this->options['template']) ? $this->options['template'] : null); $table = array(); foreach ($data as $row) { $tr = array('values' => array(), 'params' => $this->getRowSpecialParams($row)); /** @var ListingColumnTypeInterface $column */ foreach ($this->columns as $column) { $tr['values'][] = $this->renderer->renderCell($column, $row); } $table[] = $tr; } return $table; }
/** * @param ListingView $listingView * @return string */ public function renderListing(ListingView $listingView, $template = null) { $this->renderer->load($template ?: $listingView->getTemplateReference()); return $this->renderer->renderListing($listingView); }