ZF-5937: disableTranslator option in Zend_Form_Element_Multi makes the options disappear
Description
When the disableTranslator flag is true on a multi options element, new options added with the addMultiOption method are never really added to the options stack.
Here is the patch I made. I have not signed the CLA for the moment but I give you this patch without any restriction.
/**
* Translate an option
*
* @param string $option
* @param string $value
* @return bool
*/
protected function _translateOption($option, $value)
{
if ($this->translatorIsDisabled()) {
return false;
}
if (!isset($this->_translated[$option]) && !empty($value)) {
$trValue = $this->_translateValue($value);
if ($trValue === $value) {
return false;
}
$this->options[$option] = $trValue;
$this->_translated[$option] = true;
return true;
}
return false;
}
Comments
Posted by Edouard Cunibil (duael) on 2009-03-04T06:47:24.000+0000
Corrected file
Posted by Johan B.W. de Vries (jbwdevries) on 2009-03-20T12:09:37.000+0000
Just to clarify: _translateOption returns TRUE when the translator is disabled, while it should return FALSE.
All that needs changing is:
into
Posted by Mike Willbanks (digitalstruct) on 2009-05-23T20:34:07.000+0000
Created patch for issue and provided phpunit test.
Posted by Matthew Weier O'Phinney (matthew) on 2009-06-18T11:38:41.000+0000
Patch from Mike Willbanks applied in trunk and 1.8 release branch -- thanks!