- UiInput and UiSelect now allows NULL values to be passed
This commit is contained in:
parent
94e42747a4
commit
2014f7fdeb
|
@ -22,10 +22,11 @@ class UiInput extends UiElement implements Extension {
|
||||||
return "<?php echo ( new \\" . static::class . "() )->buildHtml($arguments) ?>";
|
return "<?php echo ( new \\" . static::class . "() )->buildHtml($arguments) ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildHtml(string $name, string $value, array $attributes = []) : string
|
public function buildHtml(string $name, ? string $value = null, array $attributes = []) : string
|
||||||
{
|
{
|
||||||
$this->setValue($value);
|
$this->setValue($value);
|
||||||
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes);
|
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes);
|
||||||
|
|
||||||
return $this->render();
|
return $this->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class UiSelect extends UiElement implements Extension {
|
||||||
return "<?php echo ( new \\" . static::class . "() )->buildHtml($arguments) ?>";
|
return "<?php echo ( new \\" . static::class . "() )->buildHtml($arguments) ?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildHtml(string $name, array $list, $value, array $attributes = [], bool $strictComparison = true) : string
|
public function buildHtml(string $name, array $list, $value = null, array $attributes = [], bool $strictComparison = true) : string
|
||||||
{
|
{
|
||||||
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes);
|
$this->attributes([ 'name' => $name ] + $attributes + $this->attributes);
|
||||||
$this->setList($list, $value, $strictComparison);
|
$this->setList($list, $value, $strictComparison);
|
||||||
|
@ -40,6 +40,7 @@ class UiSelect extends UiElement implements Extension {
|
||||||
foreach($list as $key => $item) {
|
foreach($list as $key => $item) {
|
||||||
if ($item instanceof UiElement) {
|
if ($item instanceof UiElement) {
|
||||||
$this->append($item);
|
$this->append($item);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
elseif ( is_array($item) ) {
|
elseif ( is_array($item) ) {
|
||||||
$obj = new UiElement("optgroup");
|
$obj = new UiElement("optgroup");
|
||||||
|
|
Loading…
Reference in New Issue