public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view) { $label = $element->getLabel(); if (empty($label)) { $label = $element->getName(); } return '<div class="pointer" onClick = goToErrorLabel(\'' . $element->getId() . '\')>' . $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd() . '</div>'; }
/** * * @param Zend_Form_Element $element * @return string[] */ private function _getDefaultElementDecorator(Zend_Form_Element $element) { $decorator = array(); if ($element instanceof Zend_Form_Element_Checkbox) { $decorator[] = array(array('Label-Open' => 'HtmlTag'), array('tag' => 'label', 'class' => 'checkbox', 'id' => $element->getId() . '-label', 'for' => $element->getName(), 'openOnly' => true)); $decorator[] = 'ViewHelper'; $decorator[] = array('CheckBoxLabel'); $decorator[] = array(array('Label-Closing' => 'HtmlTag'), array('tag' => 'label', 'closeOnly' => true)); $decorator[] = array('Errors', array('placement' => 'append')); $decorator[] = array('Description', array('tag' => 'span', 'class' => 'help-block')); $decorator[] = array(array('Inner-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-sm-10')); $decorator[] = array(array('Outer-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')); return $decorator; } if ($element instanceof Zend_Form_Element_Submit || $element instanceof Zend_Form_Element_Reset || $element instanceof Zend_Form_Element_Button) { $decorator[] = 'ViewHelper'; return $decorator; } if ($element instanceof Zend_Form_Element_File) { $decorator[] = 'File'; $decorator[] = 'Errors'; $decorator[] = array('Description', array('tag' => 'span', 'class' => 'input-file', 'placement' => 'prepend')); $decorator[] = array(array('File-Wrapper' => 'HtmlTag'), array('tag' => 'span', 'class' => 'btn btn-default')); } else { $decorator[] = 'ViewHelper'; $decorator[] = 'Errors'; $decorator[] = array('Description', array('tag' => 'span', 'class' => 'help-block')); } if ($this->_type === self::TYPE_HORIZONTAL) { $decorator[] = array(array('Inner-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-sm-10')); $decorator[] = array('Label', array('class' => 'control-label col-sm-2')); $decorator[] = array(array('Outer-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')); } else { $decorator[] = 'Label'; $decorator[] = array('HtmlTag', array('tag' => 'div', 'class' => 'form-group')); } return $decorator; }
/** * Updates the ID of the given element. * * @param Zend_Form_Element $element */ protected function updateId(Zend_Form_Element $element) { $currentId = $element->getId(); $newId = $currentId . '-' . uniqid(); $element->setAttrib('id', $newId); }
public function decorateConfig($content, Zend_Form_Element $element, array $options) { $view = $this->getView(); $value = $view->escape($element->getValue()); return '<textarea name="' . $view->escape($element->getName()) . '"' . ' class="f-max-size" readonly="readonly"' . ' id="' . $view->escape($element->getId()) . '"' . ' rows="' . (substr_count($value, "\n") + 1) . '" cols="80" style="width: 100%;"' . '>' . $value . '</textarea>'; }