/** * @param array $actions * @param Column $column * @param array $options * * @return Collection */ protected function getContent(array $actions, Column $column, array $options) { $collection = new Collection(); foreach ($actions as $action) { $collection->add(new Link($this->getUrl($action), $this->getLabel($action['name'], $column->getGrid()->getName(), $options[ActionsExtension::NAME . '_trans']))); } return $collection; }
/** * {@inheritdoc} */ public function buildColumn(Column $column, $type, array $options = array()) { if ($column->hasHandler(self::NAME)) { return; } if (!isset($this->formatters[$type])) { throw FormatterException::notFound($type, array_keys($this->formatters)); } $column->register(new DataHandler($this->formatters[$type])); }
/** * {@inheritdoc} */ public function handle(Column $column, Entity $entity = null, array $options = array()) { $value = $entity->get($column->getName(), $options['path']); return new Cell(new Data($this->formatter->format($value, $options))); }
/** * {@inheritdoc} */ public function buildColumn(Column $column, $type, array $options = array()) { if ($options[self::NAME]->isEnabled() && self::NAME === $type) { $column->register($this->dataHandler, true)->register($this->labelHandler, true); } }
/** * {@inheritdoc} */ public function handle(Column $column, Entity $entity = null, array $options = array()) { $subject = is_string($options[LabelExtension::NAME]) ? $options[LabelExtension::NAME] : $column->getName(); return new Cell($this->getLabel($subject, $column->getGrid()->getName(), $options[LabelExtension::NAME . '_trans'])); }
/** * Column is not configured. * * @param Column $column * @param string $operation * * @return WorkflowException */ public static function notConfiguredColumn(Column $column, $operation) { return new self(sprintf('Column "%s" is not configured and can not process %s operation.', $column->getName(), $operation)); }
public function testExceptionWhenBuildingNonConfiguredColumn() { $column = new Column(); $this->setExpectedException('Jfsimon\\Datagrid\\Exception\\WorkflowException'); $column->build(new Row('data')); }
/** * {@inheritdoc} */ public function buildColumn(Column $column, $type, array $options = array()) { if ($options[self::NAME]) { $column->register($this->handler); } }