emailConfig = $emailConfig; $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(\Magento\Framework\Serialize\Serializer\Json::class); parent::__construct($context, $coreRegistry); } /** * Set template data to retrieve it in template info form * * @return void * @throws \RuntimeException */ public function execute() { $this->_view->loadLayout(); $template = $this->_initTemplate('id'); $templateId = $this->getRequest()->getParam('code'); try { $parts = $this->emailConfig->parseTemplateIdParts($templateId); $templateId = $parts['templateId']; $theme = $parts['theme']; if ($theme) { $template->setForcedTheme($templateId, $theme); } $template->setForcedArea($templateId); $template->loadDefault($templateId); $template->setData('orig_template_code', $templateId); $template->setData( 'template_variables', $this->serializer->serialize($template->getVariablesOptionArray(true)) ); $templateBlock = $this->_view->getLayout()->createBlock( \Magento\Email\Block\Adminhtml\Template\Edit::class, 'template_edit', [ 'data' => [ 'email_template' => $template ] ] ); $template->setData('orig_template_currently_used_for', $templateBlock->getCurrentlyUsedForPaths(false)); $this->getResponse()->representJson( $this->serializer->serialize($template->getData()) ); } catch (\Exception $e) { $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); } } }