fix label setLabel

This commit is contained in:
kali
2024-03-18 13:25:38 +03:00
parent 1d20c0863b
commit a73c5e8170
8 changed files with 53 additions and 18 deletions

View File

@ -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;
}