diff --git a/src/Element.php b/src/Element.php index 49bdfa4..82f289a 100644 --- a/src/Element.php +++ b/src/Element.php @@ -16,6 +16,17 @@ class Element{ public function name() : string{ return $this->data['name']; } + public function id(string $id): self{ + $this->data['id'] = $name; + return $this; + } + + public function label(string $label, string $more = ''): self { + $this->data['label'] = $label; + $this->data['label.more'] = $more; + return $this; + } + public function required(bool $value = true) : self{ $this->data['required'] = $value; return $this; @@ -42,7 +53,15 @@ class Element{ return true; } + protected function getId(): string{ + return isset($this->data['id']) ? $this->data['id'] : $this->data['name']; + } + + protected function htmlLabel(): string{ + return isset($this->data['label']) ? '\n" : ''; + } + public function html(string $more = '') : string{ - return ''; + return $this->htmlLabel().''; } } \ No newline at end of file diff --git a/src/Input.php b/src/Input.php index de45efd..b055478 100644 --- a/src/Input.php +++ b/src/Input.php @@ -135,7 +135,9 @@ class Input extends Element{ } public function html(string $more = '') : string{ - return 'htmlLabel(). + 'data['value']) && !(isset($this->data['password']) && $this->data['password'] == true) ? 'value="'.$this->data['value'].'" ' : ''). (isset($this->data['type']) ? 'type="'.$this->data['type'].'" ' : ''). (isset($this->data['title']) ? 'title="'.$this->data['title'].'" ' : ''). diff --git a/src/Select.php b/src/Select.php index cdd10bc..3a3a81b 100644 --- a/src/Select.php +++ b/src/Select.php @@ -62,7 +62,9 @@ class Select extends Element{ $options .= $option['more'].'>'.$option['text'].''; } - $html = 'data['other.text'])){ $options .= ''; diff --git a/src/TextArea.php b/src/TextArea.php index 2224ceb..6df7e3d 100644 --- a/src/TextArea.php +++ b/src/TextArea.php @@ -8,7 +8,9 @@ class TextArea extends Element{ } public function html(string $more = '') : string{ - return '';