function action_modify() { $item = $this->params->id ? $this->_load_id() : false; $result = true; if (is_callable(array($this, 'action_modify_before'))) { $result = $this->action_modify_before($this->postdata, $item); } if ($result === false) { if (!$this->is_message_set()) { $this->set_message(i18n::T('Action canceled'), false); } } else { $id = $this->collection->modify($this->get_postdata(), $this->params->id); if (is_callable(array($this, 'action_modify_after'))) { $this->action_modify_after($id); } if (!$this->is_message_set()) { $newbie = $this->collection->get_last_item(); $data = $newbie ? array() : $newbie->render(); if (core::is_debug()) { $data['_sql'] = $this->collection->connection()->get_last_query(); } // return to form if ($this->submit_type == 'apply') { $this->set_redirect($this->get_edit_url($newbie)); } // redirect `apply` //$data['redirect'] = $newbie->get_urls $this->set_message(!$id ? i18n::T('Action failed') : i18n::T($this->params->id ? 'Item modified' : 'Item added'), $id)->set_message_data($data); } } }
/** * @param $value * @return array */ protected function _escape($value) { return $this->collection->connection()->escape($value); }