Documentation

Form
in package

Embodies a RESTful form. This is meant for internal use.

Table of Contents

$action  : string
Form Action/URL
$enctype  : string
Encoding type
$fields  : array<string|int, FieldForm>
The list of Prismic\FieldForm objects that can be used
$method  : string
Form Method
$name  : string|null
Form Name/Label
$rel  : string|null
The rel if there's one
defaultData()  : array<string|int, mixed>
Initializes the data that will be sent as the API call to a default value.
getAction()  : string
Returns the action
getEnctype()  : string
Returns the enctype
getField()  : FieldForm|null
Return a single field by name
getFields()  : array<string|int, FieldForm>
Returns the fields
getMethod()  : string
Returns the method
getName()  : string|null
Returns the name
getRel()  : string|null
Returns the rel
withJsonObject()  : self
Return a new instance from unserialized JSON
withJsonString()  : static
Return a new instance from a JSON string
__construct()  : mixed
Constructs the Form object.

Properties

$action

Form Action/URL

private string $action

$enctype

Encoding type

private string $enctype

$fields

The list of Prismic\FieldForm objects that can be used

private array<string|int, FieldForm> $fields

$method

Form Method

private string $method

$name

Form Name/Label

private string|null $name

$rel

The rel if there's one

private string|null $rel

Methods

defaultData()

Initializes the data that will be sent as the API call to a default value.

public defaultData() : array<string|int, mixed>
Return values
array<string|int, mixed>

the array of arguments that will be passed

getAction()

Returns the action

public getAction() : string
Return values
string

getEnctype()

Returns the enctype

public getEnctype() : string
Return values
string

getField()

Return a single field by name

public getField(string $name) : FieldForm|null
Parameters
$name : string
Return values
FieldForm|null

getFields()

Returns the fields

public getFields() : array<string|int, FieldForm>
Return values
array<string|int, FieldForm>

getMethod()

Returns the method

public getMethod() : string
Return values
string

getName()

Returns the name

public getName() : string|null
Return values
string|null

getRel()

Returns the rel

public getRel() : string|null
Return values
string|null

withJsonObject()

Return a new instance from unserialized JSON

public static withJsonObject(stdClass $json) : self
Parameters
$json : stdClass
Return values
self

withJsonString()

Return a new instance from a JSON string

public static withJsonString(string $json) : static
Parameters
$json : string
Return values
static

__construct()

Constructs the Form object.

private __construct(string|null $name, string $method, string|null $rel, string $enctype, string $action, array<string|int, mixed> $fields) : mixed
Parameters
$name : string|null

the name of the form

$method : string

the method to use

$rel : string|null

the rel if there's one

$enctype : string

the encoding type

$action : string

the action

$fields : array<string|int, mixed>

the list of Prismic::FieldForm objects that can be used

Return values
mixed

Search results