1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00

Fix issue processwire/processwire-issues#374 where save+next in page editor should not proceed to next page when there were errors on editing page

This commit is contained in:
Ryan Cramer
2017-09-20 07:03:02 -04:00
parent fffebd9214
commit 327576ff7a

View File

@@ -1345,6 +1345,8 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
return; return;
} }
} }
$formErrors = 0;
// remove temporary status that may have been assigned by ProcessPageAdd quick add mode // remove temporary status that may have been assigned by ProcessPageAdd quick add mode
if($this->page->hasStatus(Page::statusTemp)) $this->page->removeStatus(Page::statusTemp); if($this->page->hasStatus(Page::statusTemp)) $this->page->removeStatus(Page::statusTemp);
@@ -1363,7 +1365,6 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$this->message(sprintf($this->_('Change: %s'), implode(', ', $changes)), Notice::debug); // Message shown for each changed field $this->message(sprintf($this->_('Change: %s'), implode(', ', $changes)), Notice::debug); // Message shown for each changed field
} }
$formErrors = 0;
foreach($this->notices as $notice) { foreach($this->notices as $notice) {
if($notice instanceof NoticeError) $formErrors++; if($notice instanceof NoticeError) $formErrors++;
} }
@@ -1415,6 +1416,8 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
$submitAction = $this->wire('input')->post('_after_submit_action'); $submitAction = $this->wire('input')->post('_after_submit_action');
if($this->redirectUrl) { if($this->redirectUrl) {
// non-default redirectUrl overrides after_submit_action // non-default redirectUrl overrides after_submit_action
} else if($formErrors) {
// if there were errors to attend to, stay where we are
} else if($submitAction == 'exit') { } else if($submitAction == 'exit') {
$this->redirectUrl = '../'; $this->redirectUrl = '../';
} else if($submitAction == 'view') { } else if($submitAction == 'view') {