Touren application
[infodrom.org/touren.infodrom.org] / core / formelement.class.php
1 <?php
2
3 class FormElement implements FormElementInterface
4 {
5     protected $type;
6     protected $item;
7
8     public function __construct($type, $item)
9     {
10         $this->type = $type;
11         $this->item = $item;
12     }
13
14     public function toString()
15     {
16         return Template::render('input/' . $this->type, $this->item);
17     }
18
19     public function __toString()
20     {
21         try {
22             return $this->toString();
23         } catch (Throwable $e) {
24             error_log($e->getMessage());
25             return '';
26         }
27     }
28 }