public field ( mixed $name, array $options = [] ) : string | ||
$name | mixed | The name of the field to render. If the form was bound to an object passed in `create()`, `$name` should be the name of a field in that object. Otherwise, can be any arbitrary field name, as it will appear in POST data. Alternatively supply an array of fields that will use the same options array($field1 => $label1, $field2, $field3 => $label3) |
$options | array | Rendering options for the form field. The available options are as
follows:
- `'label'` _mixed_: A string or array defining the label text and / or
parameters. By default, the label text is a human-friendly version of `$name`.
However, you can specify the label manually as a string, or both the label
text and options as an array, i.e.:
`array('Your Label Title' => array('class' => 'foo', 'other' => 'options'))`.
- `'type'` _string_: The type of form field to render. Available default options
are: `'text'`, `'textarea'`, `'select'`, `'checkbox'`, `'password'` or
`'hidden'`, as well as any arbitrary type (i.e. HTML5 form fields).
- `'template'` _string_: Defaults to `'template'`, but can be set to any named
template string, or an arbitrary HTML fragment. For example, to change the
default wrapper tag from ` ` to ` |
Результат | string | Returns a form input (the input type is based on the `'type'` option), with
label and error message, wrapped in a ` ` element. |