Little fixes in serializefield and multilangform
This commit is contained in:
parent
6e12c3eea3
commit
0e0adcb05f
2 changed files with 18 additions and 5 deletions
|
|
@ -18,6 +18,7 @@ class SerializeField extends PhangoField {
|
||||||
public $quot_close='\'';
|
public $quot_close='\'';
|
||||||
public $std_error='';
|
public $std_error='';
|
||||||
public $related_type='';
|
public $related_type='';
|
||||||
|
public $callback_values='PhangoApp\PhaModels\CoreFields\SerializeField::set_format';
|
||||||
|
|
||||||
//type_data can be any field type that is loaded IntegerField, etc..
|
//type_data can be any field type that is loaded IntegerField, etc..
|
||||||
|
|
||||||
|
|
@ -91,12 +92,24 @@ class SerializeField extends PhangoField {
|
||||||
public function show_formatted($value)
|
public function show_formatted($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
$real_value=unserialize($value);
|
return $this->callback_values($value);
|
||||||
|
|
||||||
return implode(', ', $return_value);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for choose the callback method for format the value
|
||||||
|
*/
|
||||||
|
|
||||||
|
static public function set_format($serialize_value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$real_value=unserialize($value);
|
||||||
|
|
||||||
|
return implode(', ', $return_value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static function unserialize($value)
|
static function unserialize($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ class MultiLangForm extends BaseForm{
|
||||||
|
|
||||||
public $type_form;
|
public $type_form;
|
||||||
|
|
||||||
public function __construct($name, $value)
|
public function __construct($name, $value, $type_form='PhangoApp\PhaModels\Forms\BaseForm')
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->type_form=new BaseForm($name, $value);
|
$this->type_form=new $type_form($name, $value);
|
||||||
|
|
||||||
parent::__construct($name, $value);
|
parent::__construct($name, $value);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue