class FormWidget implements Renderable

Class Form.

Traits

PoppyTrait

Properties

bool $inbox
bool $ajax
protected string $title

The title of form.

protected bool $withContent

是否包含 JS 加载界面

protected Field[] $fields
protected array $data
protected array $attributes
protected array $buttons

Available buttons.

protected Closure|null $boxTools 可用操作
protected array $width

Width for label and submit field.

Methods

AuthManager
pyAuth()

get auth

pyTranslator()

get translator

Repository
pyConfig()

Get configuration instance.

DatabaseManager
pyDb()

get db

Kernel
pyConsole()

Get console instance.

Container
pyContainer()

Get IoC Container.

Mailer
pyMailer()

Get mailer instance.

SessionManager|Store
pySession()

Get session instance.

Request
pyRequest()

get request

Redirector
pyRedirector()

get redirector

Factory
pyValidation()

get validation

Dispatcher
pyEvent()

get event

LoggerInterface
pyLogger()

get logger

ResponseFactory
pyResponse()

get response

Filesystem
pyFile()

get file

UrlGenerator
pyUrl()

get url

mixed
pyCache(string $tag = '')

get cache

RedisManager
pyRedis()

get redis

Factory
pyView()

get view

pyPoppy()

get poppy

Ini
pyIni()

Ini Parser

Xml
pyXml()

Ini Parser

pyYaml()

Yaml Parser

__construct(array $data = [])

Form constructor.

array
data()

No description

fill(array|Arrayable $data = [])

Fill data to form fields.

$this
sanitize()

No description

attribute(string|array $attr, string $value = '')

Add form attributes.

string
formatAttribute(array $attributes = [])

Format form attributes form array to html.

$this
action(string $action)

Action uri of the form.

method(string $method = 'POST')

Method of the form.

$this
disablePjax()

Disable Pjax.

$this
disableReset()

Disable reset button.

$this
disableSubmit()

Disable submit button.

$this
setWidth(int $fieldWidth = 8, int $labelWidth = 2)

Set field and label width in current form.

pushField(Field $field)

Add a form field to form.

array
fields()

Get all fields of form.

bool
hasFile()

Determine if form fields has files.

bool|MessageBag
validate(Request $request)

Validate this form fields.

unbox()

No description

boxTools(Closure $closure)

设定工具栏

render()

Render the form.

Field|$this
__call(string $method, array $arguments)

Generate a Field object and add to form builder if Field exists.

string
title()

Get form title.

void
initFormAttributes()

Initialize the form attributes.

array
getVariables()

Get variables for render form.

MessageBag
mergeValidationMessages(Validator[] $validators)

Merge validation messages from input validators.

code(mixed $name, mixed $label)

No description

text(mixed $name, mixed $label)

No description

link(mixed $label)

No description

password(mixed $name, mixed $label)

No description

checkbox(mixed $name, mixed $label)

No description

radio(mixed $name, mixed $label)

No description

select(mixed $name, mixed $label)

No description

selectDo(mixed $name, mixed $label)

No description

multipleSelect(mixed $name, mixed $label)

No description

textarea(mixed $name, mixed $label)

No description

hidden(mixed $name, mixed $label)

No description

Id
id(mixed $name, mixed $label)

No description

Ip
ip(mixed $name, mixed $label)

No description

Url
url(mixed $name, mixed $label)

No description

color(mixed $name, mixed $label)

No description

captcha(mixed $name, mixed $label)

No description

email(mixed $name, mixed $label)

No description

mobile(mixed $name, mixed $label)

No description

file(mixed $name, mixed $label)

No description

image(mixed $name, mixed $label)

No description

multiImage(mixed $name, mixed $label)

No description

date(mixed $name, mixed $label)

No description

datetime(mixed $name, mixed $label)

No description

time(mixed $name, mixed $label)

No description

year(mixed $column, mixed $label)

No description

month(mixed $column, mixed $label)

No description

dateRange(mixed $start, mixed $end, mixed $label)

No description

DateTimeRange
dateTimeRange(mixed $at, mixed $label)

No description

timeRange(mixed $start, mixed $end, mixed $label)

No description

number(mixed $name, mixed $label)

No description

currency(mixed $name, mixed $label)

No description

switch() $$name, $label)

No description

display(mixed $name, mixed $label)

No description

divider(mixed $title)

No description

editor(mixed $name, mixed $label)

No description

decimal(mixed $column, mixed $label)

No description

html(mixed $html, mixed $arguments)

No description

tags(mixed $column, mixed $label)

No description

timezone(mixed $column, mixed $label)

No description

keyword(mixed $column, mixed $label)

No description

question(mixed $column, mixed $label)

No description

hook(mixed $column, mixed $label)

No description

tableInput(mixed $column, mixed $label)

No description

mixed
handle(Request $request)

No description

Details

in PoppyTrait at line 43
protected AuthManager pyAuth()

get auth

Return Value

AuthManager

in PoppyTrait at line 52
protected Translator pyTranslator()

get translator

Return Value

Translator

in PoppyTrait at line 62
protected Repository pyConfig()

Get configuration instance.

Return Value

Repository

in PoppyTrait at line 72
protected DatabaseManager pyDb()

get db

Return Value

DatabaseManager

in PoppyTrait at line 81
protected Kernel pyConsole()

Get console instance.

Return Value

Kernel

in PoppyTrait at line 90
protected Container pyContainer()

Get IoC Container.

Return Value

Container

| Application

in PoppyTrait at line 99
protected Mailer pyMailer()

Get mailer instance.

Return Value

Mailer

in PoppyTrait at line 108
protected SessionManager|Store pySession()

Get session instance.

Return Value

SessionManager|Store

in PoppyTrait at line 117
protected Request pyRequest()

get request

Return Value

Request

in PoppyTrait at line 127
protected Redirector pyRedirector()

get redirector

Return Value

Redirector

in PoppyTrait at line 136
protected Factory pyValidation()

get validation

Return Value

Factory

in PoppyTrait at line 146
protected Dispatcher pyEvent()

get event

Return Value

Dispatcher

in PoppyTrait at line 156
protected LoggerInterface pyLogger()

get logger

Return Value

LoggerInterface

in PoppyTrait at line 166
protected ResponseFactory pyResponse()

get response

Return Value

ResponseFactory

in PoppyTrait at line 176
protected Filesystem pyFile()

get file

Return Value

Filesystem

in PoppyTrait at line 186
protected UrlGenerator pyUrl()

get url

Return Value

UrlGenerator

in PoppyTrait at line 197
protected mixed pyCache(string $tag = '')

get cache

Parameters

string $tag tag

Return Value

mixed

in PoppyTrait at line 211
protected RedisManager pyRedis()

get redis

Return Value

RedisManager

in PoppyTrait at line 220
protected Factory pyView()

get view

Return Value

Factory

in PoppyTrait at line 229
protected Poppy pyPoppy()

get poppy

Return Value

Poppy

in PoppyTrait at line 238
protected Ini pyIni()

Ini Parser

Return Value

Ini

in PoppyTrait at line 247
protected Xml pyXml()

Ini Parser

Return Value

Xml

in PoppyTrait at line 256
protected Yaml pyYaml()

Yaml Parser

Return Value

Yaml

at line 144
__construct(array $data = [])

Form constructor.

Parameters

array $data

at line 154
array data()

No description

Return Value

array

at line 166
FormWidget fill(array|Arrayable $data = [])

Fill data to form fields.

Parameters

array|Arrayable $data

Return Value

FormWidget

at line 182
$this sanitize()

No description

Return Value

$this

at line 199
FormWidget attribute(string|array $attr, string $value = '')

Add form attributes.

Parameters

string|array $attr
string $value

Return Value

FormWidget

at line 220
string formatAttribute(array $attributes = [])

Format form attributes form array to html.

Parameters

array $attributes

Return Value

string

at line 243
$this action(string $action)

Action uri of the form.

Parameters

string $action

Return Value

$this

at line 253
FormWidget method(string $method = 'POST')

Method of the form.

Parameters

string $method

Return Value

FormWidget

at line 269
$this disablePjax()

Disable Pjax.

Return Value

$this

at line 281
$this disableReset()

Disable reset button.

Return Value

$this

at line 293
$this disableSubmit()

Disable submit button.

Return Value

$this

at line 308
$this setWidth(int $fieldWidth = 8, int $labelWidth = 2)

Set field and label width in current form.

Parameters

int $fieldWidth
int $labelWidth

Return Value

$this

at line 331
FormWidget pushField(Field $field)

Add a form field to form.

Parameters

Field $field

Return Value

FormWidget

at line 342
array fields()

Get all fields of form.

Return Value

array

at line 352
bool hasFile()

Determine if form fields has files.

Return Value

bool

at line 370
bool|MessageBag validate(Request $request)

Validate this form fields.

Parameters

Request $request

Return Value

bool|MessageBag

at line 389
unbox()

No description

at line 402
FormWidget boxTools(Closure $closure)

设定工具栏

Parameters

Closure $closure

Return Value

FormWidget

at line 411
render()

Render the form.

at line 462
Field|$this __call(string $method, array $arguments)

Generate a Field object and add to form builder if Field exists.

Parameters

string $method
array $arguments

Return Value

Field|$this

at line 483
string title()

Get form title.

Return Value

string

at line 491
protected void initFormAttributes()

Initialize the form attributes.

Return Value

void

at line 508
protected array getVariables()

Get variables for render form.

Return Value

array

at line 532
protected MessageBag mergeValidationMessages(Validator[] $validators)

Merge validation messages from input validators.

Parameters

Validator[] $validators

Return Value

MessageBag

at line 73
Code code(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Code

at line 73
Text text(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Text

No description

Parameters

mixed $label

Return Value

Link

at line 73
Password password(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Password

at line 73
Checkbox checkbox(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Checkbox

at line 73
Radio radio(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Radio

at line 73
Select select(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Select

at line 73
SelectDo selectDo(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

SelectDo

at line 73
MultipleSelect multipleSelect(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

MultipleSelect

at line 73
Textarea textarea(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Textarea

at line 73
Hidden hidden(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Hidden

at line 73
Id id(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Id

at line 73
Ip ip(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Ip

at line 73
Url url(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Url

at line 73
Color color(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Color

at line 73
Captcha captcha(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Captcha

at line 73
Email email(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Email

at line 73
Mobile mobile(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Mobile

at line 73
File file(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

File

at line 73
Image image(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Image

at line 73
MultiImage multiImage(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

MultiImage

at line 73
Date date(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Date

at line 73
Datetime datetime(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Datetime

at line 73
Time time(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Time

at line 73
Year year(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Year

at line 73
Month month(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Month

at line 73
DateRange dateRange(mixed $start, mixed $end, mixed $label)

No description

Parameters

mixed $start
mixed $end
mixed $label

Return Value

DateRange

at line 73
DateTimeRange dateTimeRange(mixed $at, mixed $label)

No description

Parameters

mixed $at
mixed $label

Return Value

DateTimeRange

at line 73
TimeRange timeRange(mixed $start, mixed $end, mixed $label)

No description

Parameters

mixed $start
mixed $end
mixed $label

Return Value

TimeRange

at line 73
Number number(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Number

at line 73
Currency currency(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Currency

at line 73
SwitchField switch() $$name, $label)

No description

Parameters

) $$name
$label

Return Value

SwitchField

at line 73
Display display(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Display

at line 73
Divider divider(mixed $title)

No description

Parameters

mixed $title

Return Value

Divider

at line 73
Editor editor(mixed $name, mixed $label)

No description

Parameters

mixed $name
mixed $label

Return Value

Editor

at line 73
Decimal decimal(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Decimal

at line 73
Html html(mixed $html, mixed $arguments)

No description

Parameters

mixed $html
mixed $arguments

Return Value

Html

at line 73
Tags tags(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Tags

at line 73
Timezone timezone(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Timezone

at line 73
Keyword keyword(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Keyword

at line 73
Question question(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Question

at line 73
Hook hook(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

Hook

at line 73
TableInput tableInput(mixed $column, mixed $label)

No description

Parameters

mixed $column
mixed $label

Return Value

TableInput

at line 73
mixed handle(Request $request)

No description

Parameters

Request $request

Return Value

mixed