src/View/Helper/Form.php
public function render(FormInterface $form)
    {
        if (method_exists($form, 'prepare')) {
            $form->prepare();
        }

        // Set form role
        if (!$form->getAttribute('role')) {
            $form->setAttribute('role', 'form');
        }

        $formContent = '';

        foreach ($form as $element) {
            /** @var $element \Zend\Form\Form */
            if ($element instanceof FieldsetInterface) {
                /** @noinspection PhpUndefinedMethodInspection */
                $formContent .= $this->getView()->formCollection($element);
            } else {
                $element->setOption('_form', $form);

                /** @noinspection PhpUndefinedMethodInspection */
                $formContent .= $this->getView()->formRow($element);
            }
        }

        return $this->openTag($form) . $formContent . $this->closeTag();
    }
public function render(FormInterface $form)
    {
        if (method_exists($form, 'prepare')) {
            $form->prepare();
        }

        // Set form role
        if (!$form->getAttribute('role')) {
            $form->setAttribute('role', 'form');
        }

        $formContent = '';

        foreach ($form as $element) {
            /** @var $element \Zend\Form\Form */
            if ($element instanceof FieldsetInterface) {
                /** @noinspection PhpUndefinedMethodInspection */
                $formContent .= $this->getView()->formCollection($element);
            } else {
                $element->setOption('_form', $form);

                /** @noinspection PhpUndefinedMethodInspection */
                $formContent .= $this->getView()->formRow($element);
            }
        }

        return $this->openTag($form) . $formContent . $this->closeTag();
    }
Render a form from the provided form.

@param FormInterface $form

@return string