class Form extends Link implements ArrayAccess
Form represents an HTML form.
Methods
|
__construct(DOMNode $node, string $currentUri, string $method = null)
Constructor. |
||
| DOMNode |
getNode()
Gets the node associated with this link. |
from Link |
| string |
getMethod()
Gets the form method. |
|
| string |
getUri()
Gets the URI of the form. |
|
| DOMNode |
getFormNode()
Gets the form node associated with this form. |
|
| Form |
setValues(array $values)
Sets the value of the fields. |
|
| array |
getValues()
Gets the field values. |
|
| array |
getFiles()
Gets the file field values. |
|
| array |
getPhpValues()
Gets the field values as PHP. |
|
| array |
getPhpFiles()
Gets the file field values as PHP. |
|
| Boolean |
has(string $name)
Returns true if the named field exists. |
|
|
remove(string $name)
Removes a field from the form. |
||
| FormField |
get(string $name)
Gets a named field. |
|
|
set(FormField $field)
Sets a named field. |
||
| FormField[] |
all()
Gets all fields. |
|
| Boolean |
offsetExists(string $name)
Returns true if the named field exists. |
|
| FormField |
offsetGet(string $name)
Gets the value of a field. |
|
|
offsetSet(string $name, string|array $value)
Sets the value of a field. |
||
|
offsetUnset(string $name)
Removes a field from the form. |
Details
at line 46
public
__construct(DOMNode $node, string $currentUri, string $method = null)
Constructor.
in Link at line 63
public DOMNode
getNode()
Gets the node associated with this link.
at line 207
public string
getMethod()
Gets the form method.
If no method is defined in the form, GET is returned.
at line 181
public string
getUri()
Gets the URI of the form.
The returned URI is not the same as the form "action" attribute. This method merges the value if the method is GET to mimics browser behavior.
at line 58
public DOMNode
getFormNode()
Gets the form node associated with this form.
at line 72
public Form
setValues(array $values)
Sets the value of the fields.
at line 90
public array
getValues()
Gets the field values.
The returned array does not include file fields (see getFiles).
at line 113
public array
getFiles()
Gets the file field values.
at line 144
public array
getPhpValues()
Gets the field values as PHP.
This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.
at line 162
public array
getPhpFiles()
Gets the file field values as PHP.
This method converts fields with the array notation (like foo[bar] to arrays) like PHP does.
at line 225
public Boolean
has(string $name)
Returns true if the named field exists.
at line 239
public
remove(string $name)
Removes a field from the form.
at line 255
public FormField
get(string $name)
Gets a named field.
at line 267
public
set(FormField $field)
Sets a named field.
at line 279
public FormField[]
all()
Gets all fields.
at line 291
public Boolean
offsetExists(string $name)
Returns true if the named field exists.
at line 305
public FormField
offsetGet(string $name)
Gets the value of a field.
at line 318
public
offsetSet(string $name, string|array $value)
Sets the value of a field.
at line 328
public
offsetUnset(string $name)
Removes a field from the form.