| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui; |
| 6: | |
| 7: | class Label extends View |
| 8: | { |
| 9: | public $ui = 'label'; |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | public $icon; |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $iconRight; |
| 25: | |
| 26: | |
| 27: | public $detail; |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | public $image; |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | public $imageRight; |
| 43: | |
| 44: | public $defaultTemplate = 'label.html'; |
| 45: | |
| 46: | #[\Override] |
| 47: | protected function renderView(): void |
| 48: | { |
| 49: | if ($this->icon) { |
| 50: | $this->icon = Icon::addTo($this, [$this->icon], ['BeforeContent']); |
| 51: | } |
| 52: | |
| 53: | if ($this->image) { |
| 54: | $this->image = Image::addTo($this, [$this->image], ['BeforeContent']); |
| 55: | $this->addClass('image'); |
| 56: | } |
| 57: | |
| 58: | if ($this->detail) { |
| 59: | $this->detail = View::addTo($this, [$this->detail], ['AfterContent'])->addClass('detail'); |
| 60: | } |
| 61: | |
| 62: | if ($this->iconRight) { |
| 63: | $this->iconRight = Icon::addTo($this, [$this->iconRight], ['AfterContent']); |
| 64: | } |
| 65: | |
| 66: | if ($this->imageRight) { |
| 67: | $this->imageRight = Image::addTo($this, [$this->imageRight], ['AfterContent']); |
| 68: | $this->addClass('image'); |
| 69: | } |
| 70: | |
| 71: | parent::renderView(); |
| 72: | } |
| 73: | } |
| 74: | |