public function createNewPage($input) { $input['response_type'] = 'View'; $page = $this->createPageFromInput($input); if ($page) { $startsAt = array_get($input, 'published', false) ? new \DateTime() : null; $page->version = $this->PageVersionManager->createDefaultPageVersion($page, $startsAt); $this->cacheDeviseRoutes(); } return $page; }
/** * Request a new page be created * * @param array $input * @return Redirector */ public function requestCreateNewPage($input) { $page = $this->PageManager->createNewPage($input); if ($page) { return $this->Redirect->route('dvs-pages')->with('warnings', $this->PageManager->warnings)->with('message', $this->PageManager->message); } return $this->Redirect->route('dvs-pages-create')->withInput()->withErrors($this->PageManager->errors)->with('message', $this->PageManager->message); }