fix label setLabel
This commit is contained in:
@ -11,6 +11,8 @@ class TextInput extends BaseInput
|
||||
use CreateParams;
|
||||
private string $name;
|
||||
|
||||
private bool $hasLabel = false;
|
||||
private string $labelTitle = '';
|
||||
private array $paramsArray;
|
||||
|
||||
|
||||
@ -31,6 +33,9 @@ class TextInput extends BaseInput
|
||||
{
|
||||
$paramsString = $this->createParams($this->paramsArray);
|
||||
$this->html = "<input name='$this->name' $paramsString >";
|
||||
if($this->hasLabel == true) {
|
||||
$this->html = "<label>$this->labelTitle</label> $this->html";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -53,7 +58,9 @@ class TextInput extends BaseInput
|
||||
*/
|
||||
public function setLabel(string $title): self
|
||||
{
|
||||
$this->html = "<label>$title $this->html</label>";
|
||||
$this->hasLabel = true;
|
||||
$this->labelTitle = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user