public function to_object() { $containers = array(); $attrs = parent::get_data(); $attrs['name'] = $this->name; $attrs['use_comm'] = $this->use_comm; $attrs['use_errors'] = $this->use_errors; $attrs['use_queue'] = $this->use_queue; $attrs['prefix'] = $this->get_prefix(); unset($attrs['response']); unset($attrs['request']); unset($attrs['renderer']); foreach ($this->objects as $obj) { $containers[] = $obj->to_object(); } $containers[] = array("element" => "input", "type" => 'hidden', "name" => $this->get_prefix() . 'data_hidden', "value" => json_encode($this->data_hidden)); $attrs['elements'] = $containers; $attrs['data'] = $this->get_data(true); $attrs['initial_check'] = $this->submited; foreach ($attrs['data'] as $key => $value) { if (is_null($value)) { unset($attrs['data'][$key]); } else { if ($value instanceof \DateTime) { $attrs['data'][$key] = $value->format('c'); } else { if (method_exists($value, 'to_object')) { $attrs['data'][$key] = $value->to_object(); } } } $input = $this->get_input(preg_replace('/^' . $this->get_prefix() . '/', '', $key)); if ($input && $input->type == 'password') { unset($attrs['data'][$key]); } } return $attrs; }