src/Framework/Form/Fieldset.php
public function prepareForView()
    {
        $fields = [];
        foreach ($this->fields as $groups) {
            foreach ($groups as $field) {
                if (null !== $field->getLabel()) {
                    $labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
                    $label    = new Child('label', $field->getLabel());
                    $label->setAttribute('for', $labelFor);
                    if (null !== $field->getLabelAttributes()) {
                        $label->setAttributes($field->getLabelAttributes());
                    }
                    if ($field->isRequired()) {
                        if ($label->hasAttribute('class')) {
                            $label->setAttribute('class', $label->getAttribute('class') . ' required');
                        } else {
                            $label->setAttribute('class', 'required');
                        }
                    }
                    $fields[$field->getName() . '_label'] = $label->render();
                }
                if (null !== $field->getHint()) {
                    $hint = new Child('span', $field->getHint());
                    if (null !== $field->getHintAttributes()) {
                        $hint->setAttributes($field->getHintAttributes());
                    }
                    $fields[$field->getName() . '_hint'] = $hint->render();
                }
                if ($field->hasErrors()) {
                    $fields[$field->getName() . '_errors'] = $field->getErrors();
                }
                $fields[$field->getName()] = $field->render();
            }
        }
        return $fields;
    }
public function prepareForView()
    {
        $fields = [];
        foreach ($this->fields as $groups) {
            foreach ($groups as $field) {
                if (null !== $field->getLabel()) {
                    $labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
                    $label    = new Child('label', $field->getLabel());
                    $label->setAttribute('for', $labelFor);
                    if (null !== $field->getLabelAttributes()) {
                        $label->setAttributes($field->getLabelAttributes());
                    }
                    if ($field->isRequired()) {
                        if ($label->hasAttribute('class')) {
                            $label->setAttribute('class', $label->getAttribute('class') . ' required');
                        } else {
                            $label->setAttribute('class', 'required');
                        }
                    }
                    $fields[$field->getName() . '_label'] = $label->render();
                }
                if (null !== $field->getHint()) {
                    $hint = new Child('span', $field->getHint());
                    if (null !== $field->getHintAttributes()) {
                        $hint->setAttributes($field->getHintAttributes());
                    }
                    $fields[$field->getName() . '_hint'] = $hint->render();
                }
                if ($field->hasErrors()) {
                    $fields[$field->getName() . '_errors'] = $field->getErrors();
                }
                $fields[$field->getName()] = $field->render();
            }
        }
        return $fields;
    }
public function prepareForView ( ) { $ fields = [ ] ; foreach ( $ this -> fields as $ groups ) { foreach ( $ groups as $ field ) { if ( null !== $ field -> getLabel ( ) ) { $ labelFor = $ field -> getName ( ) . ( ( $ field -> getNodeName ( ) == 'fieldset' ) ? '1' : '' ) ; $ label = new Child ( 'label' , $ field -> getLabel ( ) ) ; $ label -> setAttribute ( 'for' , $ labelFor ) ; if ( null !== $ field -> getLabelAttributes ( ) ) { $ label -> setAttributes ( $ field -> getLabelAttributes ( ) ) ; } if ( $ field -> isRequired ( ) ) { if ( $ label -> hasAttribute ( 'class' ) ) { $ label -> setAttribute ( 'class' , $ label -> getAttribute ( 'class' ) . ' required' ) ; } else { $ label -> setAttribute ( 'class' , 'required' ) ; } } $ fields [ $ field -> getName ( ) . '_label' ] = $ label -> render ( ) ; } if ( null !== $ field -> getHint ( ) ) { $ hint = new Child ( 'span' , $ field -> getHint ( ) ) ; if ( null !== $ field -> getHintAttributes ( ) ) { $ hint -> setAttributes ( $ field -> getHintAttributes ( ) ) ; } $ fields [ $ field -> getName ( ) . '_hint' ] = $ hint -> render ( ) ; } if ( $ field -> hasErrors ( ) ) { $ fields [ $ field -> getName ( ) . '_errors' ] = $ field -> getErrors ( ) ; } $ fields [ $ field -> getName ( ) ] = $ field -> render ( ) ; } } return $ fields ; }
Prepare fieldset elements for rendering with a view

@return array
Prepare fieldset elements for rendering with a view