mirror of
https://github.com/opnsense/core.git
synced 2026-05-28 04:34:51 -04:00
mvc: OptionField: allow empty values in options
This falls back to the key which isn't going to be translated since it's likely a technical term or keyword. Also translate the $subvalue which appears to have been missed before.
This commit is contained in:
parent
546de351d7
commit
b187227683
2 changed files with 8 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2019 Deciso B.V.
|
||||
* Copyright (C) 2015-2026 Deciso B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -45,12 +45,12 @@ class OptionField extends BaseListField
|
|||
// copy options to internal structure, make sure we don't copy in array structures
|
||||
foreach ($data as $key => $value) {
|
||||
if (!is_array($value)) {
|
||||
$this->internalOptionList[$key] = gettext($value);
|
||||
$this->internalOptionList[$key] = strlen($value) ? gettext($value) : $key;
|
||||
} else {
|
||||
foreach ($value as $subkey => $subval) {
|
||||
$this->internalOptionList[$subkey] = [
|
||||
'value' => strlen($subval) ? gettext($subval) : $key,
|
||||
'optgroup' => gettext($key),
|
||||
'value' => $subval,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@
|
|||
<proto type="OptionField">
|
||||
<Multiple>Y</Multiple>
|
||||
<OptionValues>
|
||||
<IPv4>IPv4</IPv4>
|
||||
<IPv6>IPv6</IPv6>
|
||||
<IPv4/>
|
||||
<IPv6/>
|
||||
</OptionValues>
|
||||
</proto>
|
||||
<interface type="InterfaceField">
|
||||
|
|
@ -73,9 +73,9 @@
|
|||
<username type="TextField"/>
|
||||
<authtype type="OptionField">
|
||||
<OptionValues>
|
||||
<Basic>Basic</Basic>
|
||||
<Bearer>Bearer</Bearer>
|
||||
<Header>Header</Header>
|
||||
<Basic/>
|
||||
<Bearer/>
|
||||
<Header/>
|
||||
</OptionValues>
|
||||
</authtype>
|
||||
<expire type="IntegerField">
|
||||
|
|
|
|||
Loading…
Reference in a new issue