| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui; |
| 6: | |
| 7: | /** |
| 8: | * Simple text block view. |
| 9: | */ |
| 10: | class Text extends View |
| 11: | { |
| 12: | public $defaultTemplate; |
| 13: | |
| 14: | public $content = ''; |
| 15: | |
| 16: | #[\Override] |
| 17: | public function render(): string |
| 18: | { |
| 19: | return $this->content; |
| 20: | } |
| 21: | |
| 22: | #[\Override] |
| 23: | public function getHtml(): string |
| 24: | { |
| 25: | return $this->content; |
| 26: | } |
| 27: | |
| 28: | /** |
| 29: | * Adds HTML paragraph. |
| 30: | * |
| 31: | * @param string $text |
| 32: | * |
| 33: | * @return $this |
| 34: | */ |
| 35: | public function addParagraph($text) |
| 36: | { |
| 37: | $this->content .= $this->getApp()->getTag('p', [], $text); |
| 38: | |
| 39: | return $this; |
| 40: | } |
| 41: | |
| 42: | /** |
| 43: | * Adds some HTML code. |
| 44: | * |
| 45: | * @return $this |
| 46: | */ |
| 47: | public function addHtml(string $html) |
| 48: | { |
| 49: | $this->content .= $html; |
| 50: | |
| 51: | return $this; |
| 52: | } |
| 53: | } |
| 54: |