Commit 3123223f authored by Ad Schellevis's avatar Ad Schellevis

(mvc) add empty option to optional interface field

parent d64260cb
...@@ -119,7 +119,12 @@ class InterfaceField extends BaseField ...@@ -119,7 +119,12 @@ class InterfaceField extends BaseField
*/ */
public function getNodeData() public function getNodeData()
{ {
$result = array (); $result = array();
// if interface is not required, add empty option
if (!$this->internalIsRequired) {
$result[""] = array("value"=>"none", "selected" => 0);
}
foreach (self::$internalOptionList[$this->internalCacheKey] as $optKey => $optValue) { foreach (self::$internalOptionList[$this->internalCacheKey] as $optKey => $optValue) {
if ($optKey == $this->internalValue) { if ($optKey == $this->internalValue) {
$selected = 1; $selected = 1;
...@@ -129,6 +134,8 @@ class InterfaceField extends BaseField ...@@ -129,6 +134,8 @@ class InterfaceField extends BaseField
$result[$optKey] = array("value"=>$optValue, "selected" => $selected); $result[$optKey] = array("value"=>$optValue, "selected" => $selected);
} }
return $result; return $result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment