/** * {@inheritdoc} */ public function buildTableFilter(TableConfig $config, $name, array $options = []) { $resolver = new OptionsResolver(); $this->configureOptions($resolver); $options['name'] = $name; $options['full_name'] = sprintf('%s_%s', $config->getName(), $name); $resolvedOptions = $resolver->resolve($options); $config->addFilter($resolvedOptions); }
/** * Generates the cells. * * @param TableView $view */ private function generateCells(TableView $view) { $sortDirs = [ColumnSort::ASC, ColumnSort::DESC]; $columns = $this->config->getColumns(); foreach ($columns as &$columnOptions) { $key = $columnOptions['full_name'] . '_sort'; $sortDir = $this->requestHelper->getVar($key, ColumnSort::NONE); $columnOptions['sorted'] = in_array($sortDir, $sortDirs); } unset($columnOptions); $this->data->first(); while ($this->data->current()) { $row = new Row($this->getCurrentRowData('id')); // TODO getCurrentRowKey() ? foreach ($columns as $columnOptions) { $cell = new Cell(); $type = $this->factory->getColumnType($columnOptions['type']); $type->buildViewCell($cell, $this, $columnOptions); $row->cells[] = $cell; } $view->rows[] = $row; $this->data->next(); } }