Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
faustfizz committed Apr 10, 2023
1 parent 0141988 commit 14ed537
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/Html/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ public function buildOptions(object $field, $data)
$opt = [];
foreach ($field->options as $key => $value) {
# code...
if(is_array($value))
if(is_numeric($key))
{
$attr = array("value" => $value['value']);
$attr = array("value" => strtolower($value));

if($field->default && strtolower($field->default) == strtolower($value['value']) || (isset($data[$field->name]) && $value['value'] == $data[$field->name]))
{
Expand All @@ -201,9 +201,9 @@ public function buildOptions(object $field, $data)

$attr = array_filter($attr);

$opt[] = Html::option(ucfirst($value['label']), $attr);
$opt[] = Html::option(ucfirst($value), $attr);
}else{
$attr = array("value" => $value);
$attr = array("value" => strtolower($key));
if($field->default && strtolower($field->default) == strtolower($value) || (isset($data[$field->name]) && $value == $data[$field->name]))
{
$attr['selected'] = true;
Expand Down

0 comments on commit 14ed537

Please sign in to comment.