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: * Column for formatting image.
12: */
13: class Image extends Table\Column
14: {
15: public array $attr = ['all' => ['class' => ['center aligned single line']]];
16:
17: #[\Override]
18: public function getDataCellTemplate(Field $field = null): string
19: {
20: $caption = $field ? $field->getCaption() : $this->shortName;
21:
22: return $this->getApp()->getTag('img/', ['src' => parent::getDataCellTemplate($field), 'alt' => $caption, 'border' => '0']);
23: }
24: }
25: