Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 6ce1c62

Browse files
committed
MAGETWO-89162: Build stabilization
1 parent 2e55a51 commit 6ce1c62

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

app/code/Magento/Cms/Block/Adminhtml/Page/Edit/SaveButton.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ public function getButtonData()
3030
'targetName' => 'cms_page_form.cms_page_form',
3131
'actionName' => 'save',
3232
'params' => [
33-
true,
34-
[
35-
'back' => 'continue'
36-
]
33+
false
3734
]
3835
]
3936
]
@@ -87,10 +84,7 @@ private function getOptions()
8784
'targetName' => 'cms_page_form.cms_page_form',
8885
'actionName' => 'save',
8986
'params' => [
90-
true,
91-
[
92-
'back' => 'close'
93-
]
87+
true
9488
]
9589
]
9690
]

app/code/Magento/Cms/Controller/Adminhtml/Page/Save.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,9 @@ public function execute()
111111
try {
112112
$this->pageRepository->save($model);
113113
$this->messageManager->addSuccessMessage(__('You saved the page.'));
114-
$this->dataPersistor->clear('cms_page');
115-
return $this->processPageReturn($model, $data, $resultRedirect);
114+
return $this->processResultRedirect($model, $resultRedirect, $data);
116115
} catch (LocalizedException $e) {
117-
$this->messageManager->addExceptionMessage($e->getPrevious() ?:$e);
116+
$this->messageManager->addExceptionMessage($e->getPrevious() ?: $e);
118117
} catch (\Exception $e) {
119118
$this->messageManager->addExceptionMessage($e, __('Something went wrong while saving the page.'));
120119
}
@@ -126,37 +125,36 @@ public function execute()
126125
}
127126

128127
/**
129-
* Process and set the page return
128+
* Process result redirect
130129
*
131-
* @param \Magento\Cms\Model\Block $model
130+
* @param \Magento\Cms\Api\Data\PageInterface $model
131+
* @param \Magento\Backend\Model\View\Result\Redirect $resultRedirect
132132
* @param array $data
133-
* @param \Magento\Framework\Controller\ResultInterface $resultRedirect
134-
* @return \Magento\Framework\Controller\ResultInterface
133+
* @return \Magento\Backend\Model\View\Result\Redirect
134+
* @throws LocalizedException
135135
*/
136-
private function processPageReturn($model, $data, $resultRedirect)
136+
private function processResultRedirect($model, $resultRedirect, $data)
137137
{
138-
$redirect = $data['back'] ?? 'close';
139-
140-
if ($redirect === 'duplicate') {
138+
if ($this->getRequest()->getParam('back', false) === 'duplicate') {
141139
$newPage = $this->pageFactory->create(['data' => $data]);
142140
$newPage->setId(null);
143-
$identifier = $newPage->getIdentifier() . '-' . uniqid();
141+
$identifier = $model->getIdentifier() . '-' . uniqid();
144142
$newPage->setIdentifier($identifier);
145143
$newPage->setIsActive(false);
146144
$this->pageRepository->save($newPage);
147145
$this->messageManager->addSuccessMessage(__('You duplicated the page.'));
148-
$resultRedirect->setPath(
146+
return $resultRedirect->setPath(
149147
'*/*/edit',
150148
[
151149
'page_id' => $newPage->getId(),
152150
'_current' => true
153151
]
154152
);
155-
} else if ($redirect === 'continue') {
156-
$resultRedirect->setPath('*/*/edit', ['page_id' => $model->getId(), '_current' => true]);
157-
} else if ($redirect === 'close') {
158-
$resultRedirect->setPath('*/*/');
159153
}
160-
return $resultRedirect;
154+
$this->dataPersistor->clear('cms_page');
155+
if ($this->getRequest()->getParam('back')) {
156+
return $resultRedirect->setPath('*/*/edit', ['page_id' => $model->getId(), '_current' => true]);
157+
}
158+
return $resultRedirect->setPath('*/*/');
161159
}
162160
}

0 commit comments

Comments
 (0)