public function action_edit($id) { // Find the page $page = Jelly::select('kohanut_page', $id); if (!$page->loaded()) { return $this->admin_error(__('Could not find page with ID :id.', array(':id' => $id))); } // If this page is an external link, there is no content to edit, redirect to edit meta if ($page->islink) { $this->request->redirect(Route::get('kohanut-admin')->uri(array('controller' => 'pages', 'action' => 'meta', 'params' => $id))); } // If there is post, they are adding a new element if ($_POST) { $this->request->redirect(Route::get('kohanut-admin')->uri(array('controller' => 'elements', 'action' => 'add', 'params' => Arr::get($_POST, 'type', NULL) . '/' . $id . '/' . Arr::get($_POST, 'area', NULL)))); } // Make it so the usual admin stuff is not shown $this->auto_render = FALSE; // Make it so the admin pane for pages is shown Kohanut::$adminmode = TRUE; Kohanut::style(Route::get('kohanut-media')->uri(array('file' => 'css/page.css'))); // Render the page $this->request->response = $page->render(); }