| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui\Table\Column; |
| 6: | |
| 7: | use Atk4\Data\Field; |
| 8: | use Atk4\Ui\Table; |
| 9: | |
| 10: | /** |
| 11: | * Implements Column helper for grid. |
| 12: | */ |
| 13: | class Template extends Table\Column |
| 14: | { |
| 15: | /** @var string User-defined template for this Column. */ |
| 16: | public $template; |
| 17: | |
| 18: | /** |
| 19: | * Call new Table\Column\Template('{$name} {$surname}');. |
| 20: | */ |
| 21: | public function __construct(string $template) |
| 22: | { |
| 23: | parent::__construct(); |
| 24: | |
| 25: | $this->template = $template; |
| 26: | } |
| 27: | |
| 28: | #[\Override] |
| 29: | public function getDataCellTemplate(Field $field = null): string |
| 30: | { |
| 31: | return $this->template; |
| 32: | } |
| 33: | } |
| 34: |