/** * @param IfwPsn_Vendor_Zend_Form_Element|string $element * @param null $name * @param null $options * @return IfwPsn_Vendor_Zend_Form * @throws IfwPsn_Vendor_Zend_Form_Exception */ public function addElement($element, $name = null, $options = null) { if ($element instanceof IfwPsn_Vendor_Zend_Form_Element) { $name = $element->getName(); } IfwPsn_Wp_Proxy_Action::doAction($this->getName() . '_before_' . $name, $this); $result = parent::addElement($element, $name, $options); $decoratorHtml = $result->getElement($name)->getDecorator('HtmlTag'); if ($decoratorHtml) { $decoratorHtml->setOption('id', 'form_element_' . $name); } IfwPsn_Wp_Proxy_Action::doAction($this->getName() . '_after_' . $name, $this); return $result; }
/** * Get value * * If element type is one of the button types, returns the label. * * @param IfwPsn_Vendor_Zend_Form_Element $element * @return string|null */ public function getValue($element) { if (!$element instanceof IfwPsn_Vendor_Zend_Form_Element) { return null; } foreach ($this->_buttonTypes as $type) { if ($element instanceof $type) { if (stristr($type, 'button')) { $element->content = $element->getLabel(); return $element->getValue(); } return $element->getLabel(); } } return $element->getValue(); }
/** * Render element label * * @param IfwPsn_Vendor_Zend_Form_Element $element * @param IfwPsn_Vendor_Zend_View_Interface $view * @return string */ public function renderLabel(IfwPsn_Vendor_Zend_Form_Element $element, IfwPsn_Vendor_Zend_View_Interface $view) { $label = $element->getLabel(); if (empty($label)) { $label = $element->getName(); // Translate element name if (null !== ($translator = $element->getTranslator())) { $label = $translator->translate($label); } } if ($this->getEscape()) { $label = $view->escape($label); } return $this->getMarkupElementLabelStart() . $label . $this->getMarkupElementLabelEnd(); }
/** * Add element to stack * * @param IfwPsn_Vendor_Zend_Form_Element $element * @return IfwPsn_Vendor_Zend_Form_DisplayGroup */ public function addElement(IfwPsn_Vendor_Zend_Form_Element $element) { $this->_elements[$element->getName()] = $element; $this->_groupUpdated = true; // Display group will now handle display of element if (null !== ($form = $this->getForm())) { $form->removeFromIteration($element->getName()); } return $this; }