Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Latest commit

 

History

History
63 lines (42 loc) · 1.46 KB

zend.form.view.helper.form.rst

File metadata and controls

63 lines (42 loc) · 1.46 KB
orphan

Form

The Form view helper is used to render a <form> HTML element and its attributes.

It iterates through all its elements and relies on the FormCollection and FormRow view helpers to render them appropriately.

You can also use Zend\\Form\\View\\Helper\\FormRow <zend.form.view.helper.form-row> in conjunction with Form::openTag() and Form::closeTag() to have a more fine grained control over the output.

Basic usage:

/**
 * inside view template
 *
 * @var \Zend\View\Renderer\PhpRenderer $this
 * @var \Zend\Form\Form $form
 */

echo $this->form($form);
// i.e.
// <form action="" method="POST">
//    <label>
//       <span>Some Label</span>
//       <input type="text" name="some_element" value="">
//    </label>
// </form>

The following public methods are in addition to those inherited from Zend\\Form\\View\\Helper\\AbstractHelper <zend.form.view.helper.abstract-helper.methods>.

__invoke(FormInterface $form = null)

Prepares and renders the whole form.

param $form

A Form object.

rtype

string

openTag(FormInterface $form = null)

Renders the <form> open tag for the $form instance.

rtype

string

closeTag()

Renders a </form> closing tag.

rtype

string