Index: library/Zend/Form.php =================================================================== --- library/Zend/Form.php (revision 25042) +++ library/Zend/Form.php (working copy) @@ -1025,19 +1025,6 @@ throw new Zend_Form_Exception('Elements specified by string must have an accompanying name'); } - if (is_array($this->_elementDecorators)) { - if (null === $options) { - $options = array('decorators' => $this->_elementDecorators); - } elseif ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - if (is_array($options) - && !array_key_exists('decorators', $options) - ) { - $options['decorators'] = $this->_elementDecorators; - } - } - $this->_elements[$name] = $this->createElement($element, $name, $options); } elseif ($element instanceof Zend_Form_Element) { $prefixPaths = array(); @@ -1101,12 +1088,22 @@ if ((null === $options) || !is_array($options)) { $options = array('prefixPath' => $prefixPaths); + + if (is_array($this->_elementDecorators)) { + $options['decorators'] = $this->_elementDecorators; + } } elseif (is_array($options)) { if (array_key_exists('prefixPath', $options)) { $options['prefixPath'] = array_merge($prefixPaths, $options['prefixPath']); } else { $options['prefixPath'] = $prefixPaths; } + + if (is_array($this->_elementDecorators) + && !array_key_exists('decorators', $options) + ) { + $options['decorators'] = $this->_elementDecorators; + } } $class = $this->getPluginLoader(self::ELEMENT)->load($type);