src/Form/View/Helper/FormCollection.php
protected function renderElements(FieldsetInterface $fieldset)
    {
        $markup = '';
        $elementHelper = $this->getElementHelper();

        $elements = ArrayUtils::iteratorToArray($fieldset, false);
        foreach ($elements as $key => $elementOrFieldset) {
            if ($elementOrFieldset instanceof FieldsetInterface &&
                $fieldset instanceof Collection
            ) {
                $elementOrFieldset->setAttribute('data-counter', $key);
            	$elementOrFieldset->setOption(
            	    'allow_remove',
            	    $key >= $fieldset->getOption('count')
            	       ? $fieldset->allowRemove()
            	       : false
            	);
            }

            $markup .= $elementHelper($elementOrFieldset);
        }

        $this->reset($fieldset);

        return $markup;
    }
protected function renderElements(FieldsetInterface $fieldset)
    {
        $markup = '';
        $elementHelper = $this->getElementHelper();

        $elements = ArrayUtils::iteratorToArray($fieldset, false);
        foreach ($elements as $key => $elementOrFieldset) {
            if ($elementOrFieldset instanceof FieldsetInterface &&
                $fieldset instanceof Collection
            ) {
                $elementOrFieldset->setAttribute('data-counter', $key);
            	$elementOrFieldset->setOption(
            	    'allow_remove',
            	    $key >= $fieldset->getOption('count')
            	       ? $fieldset->allowRemove()
            	       : false
            	);
            }

            $markup .= $elementHelper($elementOrFieldset);
        }

        $this->reset($fieldset);

        return $markup;
    }
protected function renderElements ( FieldsetInterface $ fieldset ) { $ markup = '' ; $ elementHelper = $ this -> getElementHelper ( ) ; $ elements = ArrayUtils :: iteratorToArray ( $ fieldset , false ) ; foreach ( $ elements as $ key => $ elementOrFieldset ) { if ( $ elementOrFieldset instanceof FieldsetInterface && $ fieldset instanceof Collection ) { $ elementOrFieldset -> setAttribute ( 'data-counter' , $ key ) ; $ elementOrFieldset -> setOption ( 'allow_remove' , $ key >= $ fieldset -> getOption ( 'count' ) ? $ fieldset -> allowRemove ( ) : false ) ; } $ markup .= $ elementHelper ( $ elementOrFieldset ) ; } $ this -> reset ( $ fieldset ) ; return $ markup ; }
Render a collection by iterating through all
fieldsets and elements

@param FieldsetInterface $element
@return string
Render a collection by iterating through all fieldsets and elements