Form
class Form extends Link implements ArrayAccess
Form represents an HTML form.
Methods
No description
Gets the form method.
Gets the URI of the form.
Gets the form node associated with this form.
Sets the value of the fields.
Gets the field values.
Gets the file field values.
Gets the field values as PHP.
Gets the file field values as PHP.
Returns true if the named field exists.
Removes a field from the form.
Returns true if the named field exists.
Sets the value of a field.
Removes a field from the form.
Disables validation.
Details
at line line 47
__construct(DOMElement $node, string $currentUri, string $method = null, string $baseHref = null)
in Link at line line 59
DOMElement
getNode()
Gets the node associated with this link.
at line line 234
string
getMethod()
Gets the form method.
If no method is defined in the form, GET is returned.
at line line 201
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 line 60
DOMElement
getFormNode()
Gets the form node associated with this form.
at line line 72
$this
setValues(array $values)
Sets the value of the fields.
at line line 88
array
getValues()
Gets the field values.
The returned array does not include file fields (see getFiles).
at line line 109
array
getFiles()
Gets the file field values.
at line line 138
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 line 165
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. The returned array is consistent with the array for field values (see getPhpValues), rather than uploaded files found in $FILES. For a compound file field foo[bar] it will create foo[bar][name], instead of foo[name][bar] which would be found in $FILES.
at line line 250
bool
has(string $name)
Returns true if the named field exists.
at line line 260
remove(string $name)
Removes a field from the form.
at line line 274
FormField
get(string $name)
Gets a named field.
at line line 282
set(FormField $field)
Sets a named field.
at line line 292
FormField[]
all()
Gets all fields.
at line line 304
bool
offsetExists(string $name)
Returns true if the named field exists.
at line line 318
FormField
offsetGet(string $name)
Gets the value of a field.
at line line 331
offsetSet(string $name, string|array $value)
Sets the value of a field.
at line line 341
offsetUnset(string $name)
Removes a field from the form.
at line line 351
Form
disableValidation()
Disables validation.