1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 01:04:16 +02:00
This commit is contained in:
Ryan Cramer
2020-05-14 16:08:21 -04:00
parent 4620c2ebff
commit 3ba72d4508

View File

@@ -2048,18 +2048,21 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$message .= ' - ' . $this->_('Cannot be published until errors are corrected'); $message .= ' - ' . $this->_('Cannot be published until errors are corrected');
} }
} }
$restored = false;
if($this->input->post('restore_page') && $this->page->isTrash() && $this->page->restorable()) { if($this->input->post('restore_page') && $this->page->isTrash() && $this->page->restorable()) {
if($formErrors) { if($formErrors) {
$this->warning($this->_('Page cannot be restored while errors are present')); $this->warning($this->_('Page cannot be restored while errors are present'));
} else if($this->wire('pages')->restore($this->page, false)) { } else if($this->wire('pages')->restore($this->page, false)) {
$message = sprintf($this->_('Restored Page: %s'), '{path}') . $numChanges; $message = sprintf($this->_('Restored Page: %s'), '{path}') . $numChanges;
$restored = true;
} else { } else {
$this->warning($this->_('Error restoring page')); $this->warning($this->_('Error restoring page'));
} }
} }
$this->wire('pages')->save($this->page, $options); $this->wire('pages')->save($this->page, $options);
if($restored) $this->wire('pages')->restored($this->page);
$message = str_replace('{path}', $this->page->path, $message); $message = str_replace('{path}', $this->page->path, $message);
$this->message($message); $this->message($message);