getElement())) { $attribs = $element->getAttribs(); $options = array_merge($options, $attribs); $this->setOptions($options); } return $options; } /** * Set legend * * @param string $value * @return Zend_Form_Decorator_Fieldset */ public function setLegend($value) { $this->_legend = (string) $value; return $this; } /** * Get legend * * @return string */ public function getLegend() { $legend = $this->_legend; if ((null === $legend) && (null !== ($element = $this->getElement()))) { if (method_exists($element, 'getLegend')) { $legend = $element->getLegend(); $this->setLegend($legend); } } if ((null === $legend) && (null !== ($legend = $this->getOption('legend')))) { $this->setLegend($legend); $this->removeOption('legend'); } return $legend; } /** * Render a fieldset * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $legend = $this->getLegend(); $attribs = $this->getOptions(); $name = $element->getFullyQualifiedName(); $id = $element->getId(); if (!empty($id)) { // ID can't start with a number! $attribs['id'] = 'fieldset-'.$id; } if (null !== $legend) { if (null !== ($translator = $element->getTranslator())) { $legend = $translator->translate($legend); } $attribs['legend'] = $legend; } foreach ($this->stripAttribs as $attrib) { if (array_key_exists($attrib, $attribs)) { unset($attribs[$attrib]); } } return $view->fieldset($name, $content, $attribs); } }