\Geo_Form_Tag

فرم به روز رسانی اطلاعات کاربر را ایجاد می‌کند.

از این کلاس برای اعتبار سنجی فرم‌ها و تولید داده‌های معادل استفاده می‌شود. از این کلاس همانند مدل داده‌ای استفاده می‌شود. با استفاده از این کلاس می‌توان داده‌های اضافه ارسال شده را حذف کرده و در صورت نا مناسب بودن پارامترهای دریافتی خطای مناسب ایجاد کرد.

Summary

Methods
Properties
Constants
__construct()
initFields()
addPrefix()
isValid()
clean()
failed()
initial()
render_top_errors()
get_top_errors()
field()
current()
key()
next()
rewind()
valid()
offsetUnset()
offsetSet()
offsetGet()
offsetExists()
save()
update()
$fields
$prefix
$id_fields
$data
$cleaned_data
$errors
$is_bound
$f
$label_suffix
$user
$tag
No constants found
No protected methods found
$is_valid
N/A
No private methods found
No private properties found
N/A

Properties

$fields

$fields : 

The fields of the form.

They are the fully populated Pluf_FormField* of the form. You define them in the initFields method.

Type

$prefix

$prefix : 

Prefix for the names of the fields.

Type

$id_fields

$id_fields : 

Type

$data

$data : 

Type

$cleaned_data

$cleaned_data : 

Type

$errors

$errors : 

Type

$is_bound

$is_bound : 

Type

$f

$f : 

Type

$label_suffix

$label_suffix : 

Type

$user

$user : 

Type

$tag

$tag : 

Type

$is_valid

$is_valid : 

Type

Methods

__construct()

__construct(  $data = null,   $extra = array(),   $label_suffix = null) 

Parameters

$data
$extra
$label_suffix

initFields()

initFields(  $extra = array()) 

مقدار دهی فیلدها.

Parameters

$extra

addPrefix()

addPrefix(  $field_name) : string

Add the prefix to the form names.

Parameters

$field_name

Returns

string —

Field name or field name with form prefix.

isValid()

isValid() : array

Check if the form is valid.

It is also encoding the data in the form to be then saved. It is very simple as it leaves the work to the field. It means that you can easily extend this form class to have a more complex validation procedure like checking if a field is equals to another in the form (like for password confirmation) etc.

Returns

array —

Array of errors

clean()

clean() : array

فرآیند اصلی پاک کردن داده‌ها در فرم

با استفاده از این فراخوانی می‌توان تمام پارامترهای یک فرم را بررسی کرد. تفاوت اصلی این بررسی با سایر موارد این است که در اینجا تمام پارامترها به صورت همزمان در نظر گرفته خواهد شد.

در صورتی که بررسی به یک خطا روبرو شده باید خطای Pluf_Form_Invalid صادر شود.

Returns

array —

Cleaned data.

failed()

failed() 

Method just called after the validation if the validation failed.

This can be used to remove uploaded files. $this->['cleaned_data'] will be available but of course not fully populated and with possible garbage due to the error.

initial()

initial(  $name) : string

Get initial data for a given field.

Parameters

$name

Returns

string —

Initial data or '' of not defined.

render_top_errors()

render_top_errors() 

Get the top errors.

get_top_errors()

get_top_errors() 

Get the top errors.

field()

field(  $key) 

Get a given field by key.

Parameters

$key

current()

current() 

Iterator method to iterate over the fields.

Get the current item.

key()

key() 

next()

next() 

rewind()

rewind() 

valid()

valid() 

offsetUnset()

offsetUnset(  $index) 

Parameters

$index

offsetSet()

offsetSet(  $index,   $value) 

Parameters

$index
$value

offsetGet()

offsetGet(  $index) 

Parameters

$index

offsetExists()

offsetExists(  $index) 

Parameters

$index

save()

save(string  $commit = true) 

داده‌های مکان را ایجاد می‌کند.

از این فراخوانی برای ایجاد یک مکان جدید باید استفاده شود.

Parameters

string $commit

Throws

\Pluf_Exception

update()

update(string  $commit = true) 

داده‌های یک مکان را به روز می کند.

از این فراخوانی تنها برای به روز کردن داده‌ها باید استفاده شود.

Parameters

string $commit

Throws

\Pluf_Exception