_label = $label; } public function setOptions(array $options) { if (isset($options['options'])) { unset($options['options']); } foreach ($options as $key => $value) { $method = 'set' . ucfirst($key); if (method_exists($this, $method)) { $this->$method($value); } else { $this->_options[$key] = $value; } } return $this; } public function setTagOptions(array $options) { $this->_tagOptions = $options; return $this; } public function getTagOptions() { return $this->_tagOptions; } public function setTagOption($name, $value) { $this->_tagOptions[$name] = $value; return $this; } public function getTagOption($name) { if (array_key_exists($name, $this->_tagOptions)) { return $this->_tagOptions[$name]; } return null; } public function getLabel() { if (null === $this->_label) { $this->_label = parent::getLabel(); } return $this->_label; } public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getLabel(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $id = $this->getId(); $class = $this->getClass(); $options = $this->getOptions(); if ($element instanceof Zend_Form_Element_Captcha) { $options['id'] = $element->getId() . '-input'; } if (empty($label) && empty($tag)) { return $content; } if (!empty($label)) { $options['class'] = $class; $label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); } else { $label = ' '; } if (null !== $tag) { $decorator = new Zend_Form_Decorator_HtmlTag(); $options = ['tag' => $tag, 'id' => $id . '-label']; $options = array_merge($options, $this->getTagOptions()); $decorator->setOptions($options); $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; } } }