Skip to content

Commit a993cf1

Browse files
tiagosampaiomage2pratik
authored andcommitted
Refacotries to code base.
1 parent 38f975a commit a993cf1

File tree

9 files changed

+30
-15
lines changed

9 files changed

+30
-15
lines changed

app/code/Magento/Cms/Controller/Adminhtml/Block/InlineEdit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ public function __construct(
4343
$this->blockRepository = $blockRepository;
4444
$this->jsonFactory = $jsonFactory;
4545
}
46-
46+
4747
/**
4848
* @return \Magento\Framework\Controller\ResultInterface
49+
* @throws \Magento\Framework\Exception\LocalizedException
4950
*/
5051
public function execute()
5152
{

app/code/Magento/Cms/Controller/Adminhtml/Block/MassDelete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function execute()
6060
$block->delete();
6161
}
6262

63-
$this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $collectionSize));
63+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
6464

6565
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6666
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,42 @@ public function execute()
2626
$id = $this->getRequest()->getParam('page_id');
2727
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
2828
$resultRedirect = $this->resultRedirectFactory->create();
29+
2930
if ($id) {
3031
$title = "";
3132
try {
3233
// init model and delete
3334
$model = $this->_objectManager->create(\Magento\Cms\Model\Page::class);
3435
$model->load($id);
36+
3537
$title = $model->getTitle();
3638
$model->delete();
39+
3740
// display success message
38-
$this->messageManager->addSuccess(__('The page has been deleted.'));
41+
$this->messageManager->addSuccessMessage(__('The page has been deleted.'));
42+
3943
// go to grid
40-
$this->_eventManager->dispatch(
41-
'adminhtml_cmspage_on_delete',
42-
['title' => $title, 'status' => 'success']
43-
);
44+
$this->_eventManager->dispatch('adminhtml_cmspage_on_delete', [
45+
'title' => $title,
46+
'status' => 'success'
47+
]);
48+
4449
return $resultRedirect->setPath('*/*/');
4550
} catch (\Exception $e) {
4651
$this->_eventManager->dispatch(
4752
'adminhtml_cmspage_on_delete',
4853
['title' => $title, 'status' => 'fail']
4954
);
5055
// display error message
51-
$this->messageManager->addError($e->getMessage());
56+
$this->messageManager->addErrorMessage($e->getMessage());
5257
// go back to edit form
5358
return $resultRedirect->setPath('*/*/edit', ['page_id' => $id]);
5459
}
5560
}
61+
5662
// display error message
57-
$this->messageManager->addError(__('We can\'t find a page to delete.'));
63+
$this->messageManager->addErrorMessage(__('We can\'t find a page to delete.'));
64+
5865
// go to grid
5966
return $resultRedirect->setPath('*/*/');
6067
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function execute()
7676
if ($id) {
7777
$model->load($id);
7878
if (!$model->getId()) {
79-
$this->messageManager->addError(__('This page no longer exists.'));
79+
$this->messageManager->addErrorMessage(__('This page no longer exists.'));
8080
/** \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
8181
$resultRedirect = $this->resultRedirectFactory->create();
8282
return $resultRedirect->setPath('*/*/');

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ public function __construct(
5454
$this->pageRepository = $pageRepository;
5555
$this->jsonFactory = $jsonFactory;
5656
}
57-
57+
5858
/**
5959
* @return \Magento\Framework\Controller\ResultInterface
60+
* @throws \Magento\Framework\Exception\LocalizedException
6061
*/
6162
public function execute()
6263
{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ public function execute()
5959
$page->delete();
6060
}
6161

62-
$this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $collectionSize));
62+
$this->messageManager->addSuccessMessage(__('A total of %1 record(s) have been deleted.', $collectionSize));
6363

6464
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6565
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
66+
6667
return $resultRedirect->setPath('*/*/');
6768
}
6869
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public function execute()
5959
$item->save();
6060
}
6161

62-
$this->messageManager->addSuccess(__('A total of %1 record(s) have been disabled.', $collection->getSize()));
62+
$this->messageManager->addSuccessMessage(
63+
__('A total of %1 record(s) have been disabled.', $collection->getSize())
64+
);
6365

6466
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6567
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public function execute()
5959
$item->save();
6060
}
6161

62-
$this->messageManager->addSuccess(__('A total of %1 record(s) have been enabled.', $collection->getSize()));
62+
$this->messageManager->addSuccessMessage(
63+
__('A total of %1 record(s) have been enabled.', $collection->getSize())
64+
);
6365

6466
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
6567
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function validateRequireEntry(array $data)
119119
foreach ($data as $field => $value) {
120120
if (in_array($field, array_keys($requiredFields)) && $value == '') {
121121
$errorNo = false;
122-
$this->messageManager->addError(
122+
$this->messageManager->addErrorMessage(
123123
__('To apply changes you should fill in hidden required "%1" field', $requiredFields[$field])
124124
);
125125
}
@@ -140,6 +140,7 @@ private function validateData($data, $layoutXmlValidator)
140140
if (!empty($data['layout_update_xml']) && !$layoutXmlValidator->isValid($data['layout_update_xml'])) {
141141
return false;
142142
}
143+
143144
if (!empty($data['custom_layout_update_xml']) &&
144145
!$layoutXmlValidator->isValid($data['custom_layout_update_xml'])
145146
) {

0 commit comments

Comments
 (0)