public function action_delete() { //get name of the param, get the name of the custom fields, deletes from config array and alters table $this->auto_render = FALSE; $name = $this->request->param('id'); $field = new Model_Field(); try { if ($field->delete($name)) { Cache::instance()->delete_all(); Theme::delete_minified(); Alert::set(Alert::SUCCESS, __('Field deleted ' . $name)); } else { Alert::set(Alert::ERROR, __('Field does not exists ' . $name)); } $this->request->redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index'))); } catch (Exception $e) { //throw 500 throw new HTTP_Exception_500(); } }
public function action_delete() { //get name of the param, get the name of the custom fields, deletes from config array and alters table $this->auto_render = FALSE; $name = $this->request->param('id'); $field = new Model_Field(); try { $this->template->content = $field->delete($name) ? sprintf(__('Field %s deleted'), $name) : sprintf(__('Field %s does not exists'), $name); } catch (Exception $e) { //throw 500 throw HTTP_Exception::factory(500, $e->getMessage()); } }