Skip to content

Commit 25bf6ab

Browse files
committed
Replacing deprecated methods for Magento_Email module.
1 parent 6a358d3 commit 25bf6ab

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

app/code/Magento/Email/Controller/Adminhtml/Email/Template/Delete.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ public function execute()
2222
if (count($template->getSystemConfigPathsWhereCurrentlyUsed()) == 0) {
2323
$template->delete();
2424
// display success message
25-
$this->messageManager->addSuccess(__('You deleted the email template.'));
25+
$this->messageManager->addSuccessMessage(__('You deleted the email template.'));
2626
$this->_objectManager->get(\Magento\Framework\App\ReinitableConfig::class)->reinit();
2727
// go to grid
2828
$this->_redirect('adminhtml/*/');
2929
return;
3030
}
3131
// display error message
32-
$this->messageManager->addError(__('The email template is currently being used.'));
32+
$this->messageManager->addErrorMessage(__('The email template is currently being used.'));
3333
// redirect to edit form
3434
$this->_redirect('adminhtml/*/edit', ['id' => $template->getId()]);
3535
return;
3636
} catch (\Magento\Framework\Exception\LocalizedException $e) {
37-
$this->messageManager->addError($e->getMessage());
37+
$this->messageManager->addErrorMessage($e->getMessage());
3838
} catch (\Exception $e) {
39-
$this->messageManager->addError(
39+
$this->messageManager->addErrorMessage(
4040
__('We can\'t delete email template data right now. Please review log and try again.')
4141
);
4242
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
@@ -52,7 +52,7 @@ public function execute()
5252
}
5353
}
5454
// display error message
55-
$this->messageManager->addError(__('We can\'t find an email template to delete.'));
55+
$this->messageManager->addErrorMessage(__('We can\'t find an email template to delete.'));
5656
// go to grid
5757
$this->_redirect('adminhtml/*/');
5858
}

app/code/Magento/Email/Controller/Adminhtml/Email/Template/Preview.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function execute()
2121
$this->_view->renderLayout();
2222
$this->getResponse()->setHeader('Content-Security-Policy', "script-src 'none'");
2323
} catch (\Exception $e) {
24-
$this->messageManager->addError(__('An error occurred. The email template can not be opened for preview.'));
24+
$this->messageManager->addErrorMessage(
25+
__('An error occurred. The email template can not be opened for preview.')
26+
);
2527
$this->_redirect('adminhtml/*/');
2628
}
2729
}

app/code/Magento/Email/Controller/Adminhtml/Email/Template/Save.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function execute()
2222

2323
$template = $this->_initTemplate('id');
2424
if (!$template->getId() && $id) {
25-
$this->messageManager->addError(__('This email template no longer exists.'));
25+
$this->messageManager->addErrorMessage(__('This email template no longer exists.'));
2626
$this->_redirect('adminhtml/*/');
2727
return;
2828
}
@@ -55,7 +55,7 @@ public function execute()
5555

5656
$template->save();
5757
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->setFormData(false);
58-
$this->messageManager->addSuccess(__('You saved the email template.'));
58+
$this->messageManager->addSuccessMessage(__('You saved the email template.'));
5959
$this->_redirect('adminhtml/*');
6060
} catch (\Exception $e) {
6161
$this->_objectManager->get(
@@ -64,7 +64,7 @@ public function execute()
6464
'email_template_form_data',
6565
$request->getParams()
6666
);
67-
$this->messageManager->addError($e->getMessage());
67+
$this->messageManager->addErrorMessage($e->getMessage());
6868
$this->_forward('new');
6969
}
7070
}

0 commit comments

Comments
 (0)