Edit.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Email\Controller\Adminhtml\Email\Template;
  8. use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
  9. class Edit extends \Magento\Email\Controller\Adminhtml\Email\Template implements HttpGetActionInterface
  10. {
  11. /**
  12. * Edit transactional email action
  13. *
  14. * @return void
  15. */
  16. public function execute()
  17. {
  18. $this->_view->loadLayout();
  19. $template = $this->_initTemplate('id');
  20. $this->_setActiveMenu('Magento_Email::template');
  21. $this->_addBreadcrumb(__('Transactional Emails'), __('Transactional Emails'), $this->getUrl('adminhtml/*'));
  22. if ($this->getRequest()->getParam('id')) {
  23. $this->_addBreadcrumb(__('Edit Template'), __('Edit System Template'));
  24. } else {
  25. $this->_addBreadcrumb(__('New Template'), __('New System Template'));
  26. }
  27. $this->_view->getPage()->getConfig()->getTitle()->prepend(__('Email Templates'));
  28. $this->_view->getPage()->getConfig()->getTitle()->prepend(
  29. $template->getId() ? $template->getTemplateCode() : __('New Template')
  30. );
  31. $this->_addContent(
  32. $this->_view->getLayout()->createBlock(
  33. \Magento\Email\Block\Adminhtml\Template\Edit::class,
  34. 'template_edit',
  35. [
  36. 'data' => [
  37. 'email_template' => $template
  38. ]
  39. ]
  40. )->setEditMode(
  41. (bool)$this->getRequest()->getParam('id')
  42. )
  43. );
  44. $this->_view->renderLayout();
  45. }
  46. }