/**
  * @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;
 }
Esempio n. 2
0
 /**
  * {@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]));
 }
Esempio n. 3
0
 /**
  * {@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)));
 }
Esempio n. 4
0
 /**
  * {@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);
     }
 }
Esempio n. 5
0
 /**
  * {@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']));
 }
Esempio n. 6
0
 /**
  * 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));
 }
Esempio n. 7
0
 public function testExceptionWhenBuildingNonConfiguredColumn()
 {
     $column = new Column();
     $this->setExpectedException('Jfsimon\\Datagrid\\Exception\\WorkflowException');
     $column->build(new Row('data'));
 }
Esempio n. 8
0
 /**
  * {@inheritdoc}
  */
 public function buildColumn(Column $column, $type, array $options = array())
 {
     if ($options[self::NAME]) {
         $column->register($this->handler);
     }
 }