Zend Framework

disableTranslator option in Zend_Form_Element_Multi makes the options disappear

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.6
  • Fix Version/s: 1.8.4
  • Component/s: Zend_Form
  • Labels:
    None

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;
}

  1. Multi.php
    04/Mar/09 6:47 AM
    8 kB
    Edouard Cunibil
  2. zf-5937.patch
    23/May/09 8:34 PM
    1 kB
    Mike Willbanks

Issue Links

Activity

Hide
Edouard Cunibil added a comment -

Corrected file

Show
Edouard Cunibil added a comment - Corrected file
Hide
Johan B.W. de Vries added a comment -

Just to clarify: _translateOption returns TRUE when the translator is disabled, while it should return FALSE.

All that needs changing is:

if ($this->translatorIsDisabled()) {
            return true;
        }

into

if ($this->translatorIsDisabled()) {
            return false;
        }
Show
Johan B.W. de Vries added a comment - Just to clarify: _translateOption returns TRUE when the translator is disabled, while it should return FALSE. All that needs changing is:
if ($this->translatorIsDisabled()) {
            return true;
        }
into
if ($this->translatorIsDisabled()) {
            return false;
        }
Hide
Mike Willbanks added a comment -

Created patch for issue and provided phpunit test.

Show
Mike Willbanks added a comment - Created patch for issue and provided phpunit test.
Hide
Matthew Weier O'Phinney added a comment -

Patch from Mike Willbanks applied in trunk and 1.8 release branch – thanks!

Show
Matthew Weier O'Phinney added a comment - Patch from Mike Willbanks applied in trunk and 1.8 release branch – thanks!

People

Vote (6)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: