FormExtensibleSet: fix unsetting choosen values...
...for elements with nested choices
This commit is contained in:
parent
4e70a4a003
commit
3f1d2c6876
|
@ -78,7 +78,7 @@ class Zend_View_Helper_FormExtensibleSet extends Zend_View_Helper_FormElement
|
||||||
|
|
||||||
if ($multiOptions !== null) {
|
if ($multiOptions !== null) {
|
||||||
if (in_array($val, $validOptions)) {
|
if (in_array($val, $validOptions)) {
|
||||||
$this->removeOption($multiOptions, $val);
|
$multiOptions = $this->removeOption($multiOptions, $val);
|
||||||
} else {
|
} else {
|
||||||
continue; // Value no longer valid
|
continue; // Value no longer valid
|
||||||
}
|
}
|
||||||
|
@ -166,20 +166,25 @@ class Zend_View_Helper_FormExtensibleSet extends Zend_View_Helper_FormElement
|
||||||
return $flat;
|
return $flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removeOption(& $options, $option)
|
private function removeOption($options, $option)
|
||||||
{
|
{
|
||||||
foreach ($options as $key => $value) {
|
$unset = array();
|
||||||
|
foreach ($options as $key => & $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
if ($this->removeOption($value, $option)) {
|
$value = $this->removeOption($value, $option);
|
||||||
return true;
|
if (empty($value)) {
|
||||||
|
$unset[] = $key;
|
||||||
}
|
}
|
||||||
} elseif ($key === $option) {
|
} elseif ($key === $option) {
|
||||||
unset($options[$key]);
|
$unset[] = $key;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
foreach ($unset as $key) {
|
||||||
|
unset($options[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function suffix($cnt)
|
private function suffix($cnt)
|
||||||
|
|
Loading…
Reference in New Issue