PHP Class Controller_MVCForm, atk4
In most cases the following use is sufficient
$form->setModel('SomeModel');
If you want to import fields from multiple models, you can use this:
$ctl = $form->importFields($model,array('name','surname');
and if you want to use your own class based on this one, syntax is:
$ctl = $form->add('Controller_MVCForm_Derived')->importFields($model,array('name','surname'));
You can subsequently call importField() to add additional fields such as:
$form_field = $ctl->importField('age');
which will return newly added form field.
Show file
Open project: atk4/atk4
Class Usage Examples
Public Properties
Public Methods
Method Details
getFieldType()
public method
Redefine this method to add special handling of your own fields.
getFields()
public method
Returns array of models model_name => Model used in this form.
importField()
public method
Import one field from model into form.
importFields()
public method
Use $fields === false if you want to associate form with model, but don't create form fields.
setActualFields()
public method
Import model fields in form.
setFields()
public method
Copies model field values into form.
public update ( Form $form ) |
$form |
Form |
|
Property Details
$field_associations public property
Field associations form_field => model_field
public array $field_associations |
return |
array |
|
public Model $model |
return |
Model |
|
public Form $owner |
return |
Form |
|
$type_associations public property
Field type associations model_field_type => form_field_type
public array $type_associations |
return |
array |
|