update
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace src\inputs;
|
||||
namespace itguild\forms\inputs;
|
||||
|
||||
use src\traits\CreateOption;
|
||||
use src\traits\CreateParams;
|
||||
use itguild\forms\traits\CreateOption;
|
||||
use itguild\forms\traits\CreateParams;
|
||||
use itguild\forms\inputs\BaseInput;
|
||||
|
||||
class Select
|
||||
class Select extends BaseInput
|
||||
{
|
||||
use CreateParams;
|
||||
use CreateOption;
|
||||
@ -14,6 +15,7 @@ class Select
|
||||
private $value;
|
||||
private $paramsArray;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
@ -29,13 +31,15 @@ class Select
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @return $this
|
||||
*/
|
||||
public function create(): void
|
||||
public function create(): self
|
||||
{
|
||||
$paramsString = $this->createParams($this->paramsArray);
|
||||
$optionsString = $this->createOption($this->options, $this->value);
|
||||
echo "<select name='$this->name' $paramsString>$optionsString</select>";
|
||||
$this->html = "<select name='$this->name' $paramsString>$optionsString</select>";
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +53,16 @@ class Select
|
||||
public static function build(string $name, array $options = [], $value = null, array $paramsArray = []): void
|
||||
{
|
||||
$textarea = new self($name, $options, $value, $paramsArray);
|
||||
$textarea->create();
|
||||
$textarea->create()->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setLabel(string $title): self
|
||||
{
|
||||
$this->html = "<label>$title $this->html</label>";
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user