FormInterface
extends
RenderInterface, Serializable
in
Interface FormInterface
Table of Contents
Methods
- getAction() : string
- Get form action (URL). If action is empty, it points to the current page.
- getBlueprint() : Blueprint
- Get blueprint used in the form.
- getData() : Data|object
- Get current data passed to the form.
- getError() : string
- getErrors() : array<string|int, mixed>
- getFields() : array<string|int, mixed>
- Get form fields as an array.
- getFiles() : array<string|int, mixed>|array<string|int, UploadedFileInterface>
- Get files which were passed to the form.
- getFlash() : FormFlashInterface
- Get form flash object.
- getFormName() : string
- Get form name.
- getId() : string
- Get HTML id="..." attribute.
- getName() : string
- getNonce() : string
- Get the nonce value for a form
- getNonceAction() : string
- Get nonce action.
- getNonceName() : string
- Get nonce name.
- getTask() : string
- Get task for the form if set in blueprints.
- getUniqueId() : string
- Get unique id for the current form instance. By default regenerated on every page reload.
- getValue() : mixed
- Get a value from the form.
- handleRequest() : $this
- isSubmitted() : bool
- isValid() : bool
- render() : ContentBlockInterface|HtmlBlock
- Renders the object.
- reset() : void
- Reset form.
- setId() : void
- Sets HTML id="" attribute.
- setUniqueId() : void
- Sets unique form id.
- submit() : $this
Methods
getAction()
Get form action (URL). If action is empty, it points to the current page.
public
getAction() : string
Return values
stringgetBlueprint()
Get blueprint used in the form.
public
getBlueprint() : Blueprint
Return values
BlueprintgetData()
Get current data passed to the form.
public
getData() : Data|object
Return values
Data|objectgetError()
public
getError() : string
Return values
stringgetErrors()
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>getFields()
Get form fields as an array.
public
getFields() : array<string|int, mixed>
Note: Used in form fields.
Return values
array<string|int, mixed>getFiles()
Get files which were passed to the form.
public
getFiles() : array<string|int, mixed>|array<string|int, UploadedFileInterface>
Return values
array<string|int, mixed>|array<string|int, UploadedFileInterface>getFlash()
Get form flash object.
public
getFlash() : FormFlashInterface
Return values
FormFlashInterfacegetFormName()
Get form name.
public
getFormName() : string
Return values
stringgetId()
Get HTML id="..." attribute.
public
getId() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetNonce()
Get the nonce value for a form
public
getNonce() : string
Return values
stringgetNonceAction()
Get nonce action.
public
getNonceAction() : string
Return values
stringgetNonceName()
Get nonce name.
public
getNonceName() : string
Return values
stringgetTask()
Get task for the form if set in blueprints.
public
getTask() : string
Return values
stringgetUniqueId()
Get unique id for the current form instance. By default regenerated on every page reload.
public
getUniqueId() : string
This id is used to load the saved form state, if available.
Return values
stringgetValue()
Get a value from the form.
public
getValue(string $name) : mixed
Note: Used in form fields.
Parameters
- $name : string
handleRequest()
public
handleRequest(ServerRequestInterface $request) : $this
Parameters
- $request : ServerRequestInterface
Return values
$thisisSubmitted()
public
isSubmitted() : bool
Return values
boolisValid()
public
isValid() : bool
Return values
boolrender()
Renders the object.
public
render([string|null $layout = null ][, array<string|int, mixed> $context = [] ]) : ContentBlockInterface|HtmlBlock
Parameters
- $layout : string|null = null
-
Layout to be used.
- $context : array<string|int, mixed> = []
-
Extra context given to the renderer.
Tags
Return values
ContentBlockInterface|HtmlBlock —Returns HtmlBlock containing the rendered output.
reset()
Reset form.
public
reset() : void
setId()
Sets HTML id="" attribute.
public
setId(string $id) : void
Parameters
- $id : string
setUniqueId()
Sets unique form id.
public
setUniqueId(string $uniqueId) : void
Parameters
- $uniqueId : string
submit()
public
submit(array<string|int, mixed> $data[, array<string|int, UploadedFileInterface>|null $files = null ]) : $this
Parameters
- $data : array<string|int, mixed>
- $files : array<string|int, UploadedFileInterface>|null = null