\CMS_Form_ContentUpdate

به روزرسانی یک محتوا

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

Summary

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

Properties

$model

$model : 

The model for which the form applies.

Type

$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

$is_valid

$is_valid : 

Type

Methods

initFields()

initFields(  $extra = array()) 

Parameters

$extra

save()

save(  $commit = true) : Object

Saves or updates the model in the database.

Parameters

$commit

Returns

Object —

Model with data set from the form.

__construct()

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

Parameters

$data
$extra
$label_suffix

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

clean_name()

clean_name()