Setted defaults for choicefield and forms
This commit is contained in:
parent
82c5f8b7a0
commit
bd5c48c698
2 changed files with 17 additions and 4 deletions
|
|
@ -34,14 +34,18 @@ class ChoiceField extends PhangoField {
|
||||||
$this->default_value=$default_value;
|
$this->default_value=$default_value;
|
||||||
$this->arr_formatted['']=I18n::lang('common', 'none_selected', 'None selected');
|
$this->arr_formatted['']=I18n::lang('common', 'none_selected', 'None selected');
|
||||||
|
|
||||||
|
$parameters=[];
|
||||||
|
|
||||||
foreach($arr_values as $value)
|
foreach($arr_values as $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->arr_formatted[$value]=$value;
|
$this->arr_formatted[$value]=$value;
|
||||||
|
$parameters[$value]=$value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->parameters=[$parameters];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart_formatted()
|
function restart_formatted()
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,16 @@ use PhangoApp\PhaModels\Forms\BaseForm;
|
||||||
|
|
||||||
class SelectForm extends BaseForm{
|
class SelectForm extends BaseForm{
|
||||||
|
|
||||||
public $arr_select=array();
|
public $arr_select=[];
|
||||||
|
|
||||||
|
public function __construct($name, $value, $arr_select=[])
|
||||||
|
{
|
||||||
|
|
||||||
|
parent::__construct($name, $value);
|
||||||
|
|
||||||
|
$this->arr_select=$arr_select;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function form()
|
public function form()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue