Added new fields type
This commit is contained in:
parent
fce1896c8d
commit
0402ebebf0
6 changed files with 328 additions and 1902 deletions
|
|
@ -1168,7 +1168,7 @@ class Webmodel {
|
|||
|
||||
//Create form from model's components
|
||||
|
||||
$this->forms[$component_name]=new ModelForm($this->name, $component_name, $component->form, set_name_default($component_name), $component, $component->required, '');
|
||||
$this->forms[$component_name]=new ModelForm($this->name, $component_name, $component->form, Webmodel::set_name_default($component_name), $component, $component->required, '');
|
||||
|
||||
$this->forms[$component_name]->set_all_parameters_form($component->get_parameters_default());
|
||||
|
||||
|
|
@ -1336,10 +1336,10 @@ class Webmodel {
|
|||
public function set_component($name, $type, $arguments, $required=0)
|
||||
{
|
||||
|
||||
$rc=new ReflectionClass($type);
|
||||
$rc=new \ReflectionClass($type);
|
||||
$this->components[$name]=$rc->newInstanceArgs($arguments);
|
||||
//Set first label...
|
||||
$this->components[$name]->label=set_name_default($name);
|
||||
$this->components[$name]->label=Webmodel::set_name_default($name);
|
||||
$this->components[$name]->name_model=$this->name;
|
||||
$this->components[$name]->name_component=$name;
|
||||
$this->components[$name]->required=$required;
|
||||
|
|
@ -1396,6 +1396,20 @@ class Webmodel {
|
|||
return $this->components[$name_component]->check($value);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A internal helper function
|
||||
*
|
||||
* @param string $name Name for process
|
||||
*
|
||||
*/
|
||||
|
||||
static public function set_name_default($name)
|
||||
{
|
||||
|
||||
return ucfirst(str_replace('_', ' ', $name));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue