custom select fix

This commit is contained in:
2024-12-25 11:40:33 +03:00
parent f0bda2ee24
commit 2790105a7d
2 changed files with 14 additions and 16 deletions

View File

@ -2,23 +2,21 @@
namespace kernel\filters;
use itguild\forms\builders\SelectBuilder;
use Itguild\Tables\Filter\Filter;
use kernel\helpers\Debug;
class CustomSelectFilterForAssociativeArr extends Filter
{
public function fetch()
public function fetch(): string
{
$this->html = "<td><select class='form-control' name='$this->name'>";
foreach ($this->param as $key => $value) {
if ($key == $this->value) {
$this->html .= "<option value='$key' selected>$value</option>";
} else {
$this->html .= "<option value='$key'>$value</option>";
}
}
$this->html .= "value='$this->value'</select></td>";
return $this->html;
$select = SelectBuilder::build($this->name, [
'class' => 'form-control',
'options' => $this->param,
'value' => $this->value,
]);
return "<td>" . $select->create()->fetch() . "</td>";
}
}