Ejemplo n.º 1
0
 public function __invoke(FieldInterface $field)
 {
     $field->assignHelperCallback('TableCell.Content', function (TableCell $helper, array $rowData, $rowIndex, $columnIndex) use($field) {
         return $this->renderContent($field, $rowData, [$helper->getView(), 'escapeHtml']);
     });
     $field->assignHelperCallback('CsvCell.Content', function (CsvCell $helper, array $rowData, $rowIndex, $columnIndex) use($field) {
         return $this->renderContent($field, $rowData);
     });
 }
 public function __invoke(FieldInterface $field)
 {
     $field->assignHelperCallback('SelectFilter.DefaultVars', function () {
         $end = $this->startDate->add($this->dateInterval);
         // Swap dates if end if before start
         if ($end < $this->startDate) {
             return ['comp' => 'on-or-between', 'end' => $this->startDate->format('Y-m-d'), 'start' => $end->format('Y-m-d')];
         } else {
             return ['comp' => 'on-or-between', 'start' => $this->startDate->format('Y-m-d'), 'end' => $end->format('Y-m-d')];
         }
     });
 }
Ejemplo n.º 3
0
 /**
  * A shortcut/utility method that sets up an EditControl.Control callback
  * to use OptionInputDecorator.
  *
  * @param FieldInterface $field
  * @param CrudInterface $controlComponent
  * @param CrudInterface $optionComponent
  * @param callable $originalHtmlCallback
  */
 public static function assignEditControlCallback(FieldInterface $field, CrudInterface $controlComponent, CrudInterface $optionComponent, callable $originalHtmlCallback = null)
 {
     $field->assignHelperCallback('EditControl.Control', OptionInputDecorator::createEditControlCallback($field, $controlComponent, $optionComponent, $originalHtmlCallback));
 }