Beispiel #1
0
 public function testFormatCellUsesCallback()
 {
     $column = new Column("test");
     $column->setFormatValueCallback(function ($val, $row) {
         return $val . 'ok';
     });
     $this->assertEquals('testok', $column->formatCell('test', []));
     $column->setFormatValueCallback(null);
     $this->assertEquals('test', $column->formatCell('test', []), 'callback should have been resetted');
 }
 /**
  * @param OptionsResolver $resolver
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefault('input_format', 'Y-m-d H:i:s');
     $resolver->setRequired('output_format');
 }
Beispiel #3
0
 /**
  * Build a link
  */
 public function formatCell($value, array $rowData)
 {
     $value = parent::formatCell($value, $rowData);
     $url = call_user_func_array($this->options['UrlCallback'], [$value, $rowData]);
     return '<a href="' . $url . '" alt="' . $rowData[$this->options['LinkTextField']] . '">' . $rowData[$this->options['LinkTextField']] . '</a>';
 }
 /**
  * Build a link
  */
 public function formatCell($value, array $rowData, $context)
 {
     $value = parent::formatCell($value, $rowData, $context);
     $url = call_user_func_array($this->options['UrlCallback'], [$value, $rowData]);
     return '<a href="' . $url . '" alt="' . htmlentities($rowData[$this->options['LinkTextField']], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '">' . htmlentities($rowData[$this->options['LinkTextField']], ENT_COMPAT | ENT_HTML401, 'UTF-8') . '</a>';
 }