상속: extends Zend\Form\View\Helper\FormCollection
예제 #1
0
 public function render(\Zend\Form\ElementInterface $oElement)
 {
     if ($oElement->getOption('value_only') === true && $oElement instanceof \IteratorAggregate) {
         foreach ($oElement->getIterator() as $oElementOrFieldset) {
             $oElementOrFieldset->setOption('value_only', true);
             if ($oElement->getOption('add_hidden')) {
                 $oElementOrFieldset->setOption('add_hidden', true);
             }
         }
     }
     return parent::render($oElement);
 }
 /**
  * @param ElementInterface $oElement
  * @return string
  */
 public function render(ElementInterface $oElement)
 {
     $html = '';
     if ($oElement instanceof Collection) {
         $c = 0;
         foreach ($oElement as $key => $oElementOrFieldSet) {
             $oFieldSetHelper = $this->getFieldsetHelper();
             if ($oElementOrFieldSet instanceof AbstractLineFieldSet) {
                 $format = str_replace('__index__', $key, $this->rowWrap);
                 $format = str_replace('__label__', $oElementOrFieldSet->get('label')->getValue(), $format);
                 $format = str_replace('__text__', $oElementOrFieldSet->get('text')->getValue(), $format);
                 $html .= sprintf($format, $this->getLineType(), $oFieldSetHelper($oElementOrFieldSet, false), ucfirst($this->getLineType()));
             }
             $c++;
         }
         $html = sprintf($this->collectionWrap, $this->getLineType(), $html);
         if ($oElement instanceof Collection && $oElement->shouldCreateTemplate()) {
             $this->setShouldWrap(false);
             $html .= $this->renderTemplate($oElement);
         }
     } else {
         $html = parent::render($oElement);
     }
     return $html;
 }