From 327576ff7a6e8a238aff7731102e0c4df5be862f Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 20 Sep 2017 07:03:02 -0400 Subject: [PATCH] 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 --- wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module b/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module index 101c7f85..48edf4fb 100644 --- a/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module +++ b/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module @@ -1345,6 +1345,8 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod return; } } + + $formErrors = 0; // remove temporary status that may have been assigned by ProcessPageAdd quick add mode 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 } - $formErrors = 0; foreach($this->notices as $notice) { if($notice instanceof NoticeError) $formErrors++; } @@ -1415,6 +1416,8 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod $submitAction = $this->wire('input')->post('_after_submit_action'); if($this->redirectUrl) { // 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') { $this->redirectUrl = '../'; } else if($submitAction == 'view') {