⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

I can not use fields() and unset_edit_fields() simultaneously



shum
  • profile picture
  • Member

Posted 08 October 2012 - 14:13 PM

In fields:


public function fields()
{
$args = func_get_args();

if(isset($args[0]) && is_array($args[0]))
{
$args = $args[0];
}

$this->add_fields = $args;
$this->edit_fields = $args; //!!!!!!!!!!!!

return $this;
}


In unset_edit_fields:

protected function get_edit_fields()
{
if($this->edit_fields_checked === false)
{
$field_types = $this->get_field_types();
if(!empty($this->edit_fields)) //!!!!!!!!!!!
{
/*
.....
*/
}
else
{
/*
If i used fields() $this->edit_fields not empty! FAIL!
*/

$this->edit_fields = array();
foreach($field_types as $field)
{
//Check if an unset_edit_field is initialize for this field name
if($this->unset_edit_fields !== null && is_array($this->unset_edit_fields) && in_array($field->name,$this->unset_edit_fields))
continue;
/*
.....
*/

*/
}

$this->edit_fields_checked = true;
}
return $this->edit_fields;
}

shum
  • profile picture
  • Member

Posted 08 October 2012 - 15:39 PM

I'm sorry, I thought unset_edit_fields = "set_field_readonly"
The question is closed