Created
October 13, 2016 09:43
-
-
Save soelen/f0097df6bb7030e12a20d8f449f208f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function edit($id = null) | |
{ | |
$page = $this->Pages->get($id, [ | |
'contain' => [] | |
]); | |
if ($this->request->is(['patch', 'post', 'put'])) { | |
$page = $this->Pages->patchEntity($page, $this->request->data); | |
if ($this->Pages->save($page)) { | |
$this->Flash->success(__('The page has been saved.')); | |
return $this->redirect(['action' => 'index']); //not redirecting to index | |
} else { | |
$this->Flash->error(__('The page could not be saved. Please, try again.')); | |
} | |
} | |
$parentPages = $this->Pages->ParentPages->find('list', ['limit' => 200]); | |
$this->set(compact('page', 'parentPages')); | |
$this->set('_serialize', ['page']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment