1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 20:41:16 +02:00
This commit is contained in:
Ryan Cramer
2019-02-28 09:03:15 -05:00
parent 2f908e44e7
commit a2ec801a1a

View File

@@ -1046,7 +1046,6 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
if(!$this->isAllowedTemplate($template)) return false; if(!$this->isAllowedTemplate($template)) return false;
$page->addStatus(Page::statusUnpublished); $page->addStatus(Page::statusUnpublished);
$page->addStatus(Page::statusTemp); // ProcessPageEdit will remove this status the first time the page is saved $page->addStatus(Page::statusTemp); // ProcessPageEdit will remove this status the first time the page is saved
$page->setEditor($this->editor);
// if languages are in use, make the new page inherit the parent's language status (active vs. inactive) // if languages are in use, make the new page inherit the parent's language status (active vs. inactive)
$languages = $template->getLanguages(); $languages = $template->getLanguages();
@@ -1057,7 +1056,8 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
} }
try { try {
$this->wire('pages')->save($page); $this->wire('pages')->save($page);
$this->createdPageMessage($page);
} catch(\Exception $e) { } catch(\Exception $e) {
$this->error($e->getMessage()); $this->error($e->getMessage());
@@ -1068,14 +1068,15 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
$parent->template->childNameFormat = $nameFormatTemplate; // restore original name format $parent->template->childNameFormat = $nameFormatTemplate; // restore original name format
} }
if($page->id) { if($page->id) {
$this->createdPageMessage($page); // allow for classes descending Page to redirect to alternate editor if $this->editor is not the right kind
$this->session->redirect("../edit/?id=$page->id&new=1" . ($this->wire('input')->get('modal') ? '&modal=1' : '')); $page->setEditor($this->editor);
// redirect to edit the page
$this->session->redirect("../edit/?id=$page->id&new=1" . ($this->wire('input')->get('modal') ? '&modal=1' : ''));
return true;
} else { } else {
return false; return false;
} }
return true;
} }
/** /**